在UIKit中,结构UIInterfaceOrientationMask
可以用数组表示,如下所示:
var orientations: UIInterfaceOrientationMask = [.portrait, .landscapeRight, .landscapeLeft]
如果此类型不符合ExpressibleByArrayLiteral
协议,它是如何工作的?它只采用OptionSet
协议,似乎也不符合ExpressibleByArrayLiteral
。
此外,它唯一的init()
是:
UIInterfaceOrientationMask.init(rawValue:)
我发现init(rawValue:)
来自RawRepresentable
协议,但没有数组文字的初始化程序。
有没有其他方法可以通过数组文字表达类型,或者?