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

Value of type '[(_, CGFloat?)]' has no member 'compactMap' #64

Closed
Ilesh opened this issue May 21, 2018 · 3 comments
Closed

Value of type '[(_, CGFloat?)]' has no member 'compactMap' #64

Ilesh opened this issue May 21, 2018 · 3 comments

Comments

@Ilesh
Copy link

Ilesh commented May 21, 2018

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)
}
}
)
}

@salvimayur89
Copy link

salvimayur89 commented Jun 8, 2018

Upgrade Xcode to latest version.

@TaoufikBouabid
Copy link

compactMap(:) was introduced in Swift 4.1; in Swift 4.0.x it's flatMap(:)

@marty-suzuki
Copy link
Owner

Hi @Ilesh
I've support both of compactMap(:) and flatMap(:).
Please try 0.15.2

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

4 participants