Ramotion / expanding-collection

:octocat: ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion
https://www.ramotion.com/smartphone-app-development-ui-library-to-peek-and-pop-cards/
MIT License
5.55k stars 529 forks source link

Ambiguous NSLayoutAttribute compile error #72

Closed StewartLynch closed 6 years ago

StewartLynch commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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