We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
func addConstraints(with view: UIView, size: Size, relatedBy relation: NSLayoutRelation = .equal, multiplier: CGFloat = 1) { view.translatesAutoresizingMaskIntoConstraints = false addConstraints([ (.width, size.width), (.height, size.height) ] .compactMap { (value: (NSLayoutAttribute, CGFloat?)) in value.1.map { .init(item: view, attribute: value.0, relatedBy: relation, toItem: nil, attribute: .notAnAttribute, multiplier: multiplier, constant: $0) } } ) }
The text was updated successfully, but these errors were encountered:
Upgrade Xcode to latest version.
Sorry, something went wrong.
compactMap(:) was introduced in Swift 4.1; in Swift 4.0.x it's flatMap(:)
Hi @Ilesh I've support both of compactMap(:) and flatMap(:). Please try 0.15.2
compactMap(:)
flatMap(:)
No branches or pull requests
func addConstraints(with view: UIView,
size: Size,
relatedBy relation: NSLayoutRelation = .equal,
multiplier: CGFloat = 1) {
view.translatesAutoresizingMaskIntoConstraints = false
addConstraints([
(.width, size.width),
(.height, size.height)
]
.compactMap { (value: (NSLayoutAttribute, CGFloat?)) in
value.1.map {
.init(item: view,
attribute: value.0,
relatedBy: relation,
toItem: nil,
attribute: .notAnAttribute,
multiplier: multiplier,
constant: $0)
}
}
)
}
The text was updated successfully, but these errors were encountered: