Swift 4 转换 - 类型 'NSLayoutConstraint' 没有成员 'FormatOptions'。什么是正确的电话?

Swift 4 conversion - Type 'NSLayoutConstraint' has no member 'FormatOptions'. What would be the right call?

我有这段代码:

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)

我不断收到 "has no member" 此 class.

中所有 NSData 类型的编译器错误

我正在使用的这个库显然已更新到 Swift 4.2。为什么会出现这些编译器错误?

例如,我注意到有一个名为 NSLayoutFormatOptions 的 public 结构。我会用那个代替吗?如果是这样,我将如何使用它?

感谢您的任何见解

如果不需要指定选项,则发送一个空数组:

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)

如果需要指定选项,请从 FormatOptions 选项集中选择需要的选项,然后像我在下面所做的那样编写(我使用 .alignAllBottom 作为示例):

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)

可以找到 FormatOptions 的列表和描述 here