Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous NSLayoutAttribute compile error #72

Closed
StewartLynch opened this issue Feb 1, 2018 · 2 comments
Closed

Ambiguous NSLayoutAttribute compile error #72

StewartLynch opened this issue Feb 1, 2018 · 2 comments

Comments

@StewartLynch
Copy link

Using Xcode 9.2 and 9.3 I get a Swift Compile error in the BasePageCollectionCell.swift
Occurs in line 179 and 189

Expression type '[(NSLayoutAttribute, Double)]' is ambiguous without more context

@lifely
Copy link

lifely commented Feb 18, 2018

declaring the constraints arrays inline doesn't help transform the Double and Int Into the property type.

Here's a fix:

// create constraints
let sizeConstaints: [(NSLayoutAttribute, CGFloat)] = [(NSLayoutAttribute.width, 0.8), (NSLayoutAttribute.height, 0.9)]
for info: (attribute: NSLayoutAttribute, scale: CGFloat) in sizeConstaints {
    if let frontViewConstraint = view.getConstraint(info.attribute) {
        shadow >>>- {
            $0.attribute = info.attribute
            $0.constant = frontViewConstraint.constant * info.scale
            return
        }
    }
}

let centerConstraints: [(NSLayoutAttribute, CGFloat)] = [(NSLayoutAttribute.centerX, 0), (NSLayoutAttribute.centerY, 30)]
for info: (attribute: NSLayoutAttribute, offset: CGFloat) in centerConstraints {
    (contentView, shadow, view) >>>- {
        $0.attribute = info.attribute
        $0.constant = info.offset
        return
    }
}

@fbernack
Copy link

Having the same issue. Is ist possible to fix this in the repository?

@0ber 0ber closed this as completed in f077711 Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants