`open` class 的初始值设定项是否也需要打开?

Does the initializer of an `open` class need to be open as well?

Swift 3 介绍了我在框架中使用的新 关键字。

此框架中的 open class 是否需要在所述框架之外使用 open 初始化程序,或者 init 函数是否继承 open 声明class?

例如:

open class OpenClass {
    var A: String

    init() {           // does this init() function need to be marked open?
        A = String()
    }
}

附带问题:开放classOpenClass中的变量是否继承了它们class的开放性?

来自SE-0117 Allow distinguishing between public access and public overridability

Initializers do not participate in open checking; they cannot be declared open, and there are no restrictions on providing an initializer that has the same signature as an initializer in the superclass.

您不需要并且您不能将 init 方法声明为打开:

open class OpenClass {

    open init() { // error: only classes and overridable class members can be declared 'open'; use 'public'

    }
}

class 的所有成员的默认访问级别(属性 和方法)是 内部的, 也适用于开放 classes。