为什么UIInterfaceOrientationMask可以用数组表示?

时间:2017-08-06 15:38:40

标签: swift uikit

在UIKit中,结构UIInterfaceOrientationMask可以用数组表示,如下所示:

var orientations: UIInterfaceOrientationMask = [.portrait, .landscapeRight, .landscapeLeft]

如果此类型不符合ExpressibleByArrayLiteral协议,它是如何工作的?它只采用OptionSet协议,似乎也不符合ExpressibleByArrayLiteral

此外,它唯一的init()是:

UIInterfaceOrientationMask.init(rawValue:)

我发现init(rawValue:)来自RawRepresentable协议,但没有数组文字的初始化程序。

有没有其他方法可以通过数组文字表达类型,或者?

0 个答案:

没有答案