Ambiguous NSLayoutAttribute compile error
StewartLynch opened this issue · 2 comments
StewartLynch commented
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
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
Having the same issue. Is ist possible to fix this in the repository?