ios - watchos 3 beta 6 中的 WKInterfaceController header 拼写错误?

标签 ios swift watchkit xcode8 watchos-3

这是错字吗?

@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 术语吗?

谢谢

格雷格

最佳答案

其实是一个新的访问修饰符

https://github.com/apple/swift-evolution/blob/master/proposals/0117-non-public-subclassable-by-default.md

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/

相关文章:

swift - 如何使用 Swift 在类内部调用实例方法

ios - 在 UILabel Word Wrapped 属性后添加 '...'

iphone - 在iOS应用程序中使用GCMathParser? Xcode。

javascript - 使用 Javascript 为 phonegap 应用程序推送通知?

ios - Cocoapods - 具有内部静态库依赖的 Swift 框架

使用 libxml 的库的 swift 包管理器

ios - 无法在 WatchKit Extension (CocoaPods) 中使用 Parse 库

ios - 突然出现“iPhone应用程序中的UIApplicationDelegate从未调用过reply()”错误

ios - 添加 watch 应用程序时出现代码签名错误 - 嵌入式二进制文件未使用与父应用程序相同的证书进行签名

ios - 没有图层的 PDF 文件