Reputation: 785
I have this section of code:
let menuScrollView_constraint_H:Array = NSLayoutConstraint.constraints(withVisualFormat: "H:|[menuScrollView]|", options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: nil, views: viewsDictionary)
let menuScrollView_constraint_V:Array = NSLayoutConstraint.constraints(withVisualFormat: "V:[menuScrollView(\(menuHeight))]", options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: nil, views: viewsDictionary)
And I keep getting "has no member" compiler errors for all of the NSData
types in this class.
This library I'm using was apparently updated to Swift 4.2. How come these compiler errors are happening?
For example, I noticed there is a public struct called NSLayoutFormatOptions. Would I use that instead? If so, how would I use it?
Thank you for any insights
Upvotes: 0
Views: 1171
Reputation: 3082
If no options need to be specified, send an empty array:
let menuScrollView_constraint_H:Array = NSLayoutConstraint.constraints(withVisualFormat: "H:|[menuScrollView]|", options: [], metrics: nil, views: viewsDictionary)
let menuScrollView_constraint_V:Array = NSLayoutConstraint.constraints(withVisualFormat: "V:[menuScrollView(\(menuHeight))]", options: [], metrics: nil, views: viewsDictionary)
If options need to be specified, choose needed from the FormatOptions
Option set and write like I did below (I Used .alignAllBottom
for sample):
let menuScrollView_constraint_H:Array = NSLayoutConstraint.constraints(withVisualFormat: "H:|[menuScrollView]|", options: .alignAllBottom, metrics: nil, views: viewsDictionary)
let menuScrollView_constraint_V:Array = NSLayoutConstraint.constraints(withVisualFormat: "V:[menuScrollView(\(menuHeight))]", options: .alignAllBottom, metrics: nil, views: viewsDictionary)
List of FormatOptions
with descriptions can be found here
Upvotes: 1