这是错字吗?
@available(watchOS 2.0, *)
open class WKInterfaceController : NSObject {
public init()
open func awake(withContext context: Any?) // context from controller that did push or modal presentation. default does nothing
“开放”不应该是“可选”吗?
如果它应该开放,有人可以发布如何使用这个新的 swift 术语吗?
谢谢
格雷格
最佳答案
其实是一个新的访问修饰符
Proposed design
Introduce a new access modifier, open. As usual, this access modifier is exclusive with the other access modifiers; it is not permitted to write something like public open.
open is a context-sensitive keyword; there are no restrictions on using or creating declarations with the name open.
open is not permitted on arbitrary declarations. Only the specific declarations mentioned here may be open.
For the purposes of interpreting existing language rules, open is a higher (more permissive) access level above public.
For example, the true access level of a type member is computed as the minimum of the true access level of the type and the declared access level of the member. If the class is public but the member is open, the true access level is public. As an exception to this rule, the true access level of an open class that is a member of an public type is open.
Similarly, rules which grant access to public declarations should generally be interpreted as granting access to both public and open declarations.
关于ios - watchos 3 beta 6 中的 WKInterfaceController header 拼写错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38961415/