if let popupButton = result?.control as? NSPopUpButto {
if popupButton.numberOfItems <= 1 {
// blahblah
}
}
我想避免双重嵌套if。
if let popupButton = result?.control as? NSPopUpButton && popupButton.numberOfItems <= 1 {}
但unresolved identifier
如果我这样做,我会得到编译器错误。
有什么办法可以使这种条件在一条线上?或者因为我使用的是可选绑定,我是否被迫在if
这里嵌套?