“Cannot inherit from non-open class” swift

前端 未结 2 491
我寻月下人不归
我寻月下人不归 2021-01-03 17:56

As of Xcode 8 beta 6 I now get the compile error \"Cannot inherit from non-open class (Class)\" outside of its defining module\"

The class I was inheriting from was

2条回答
  •  梦毁少年i
    2021-01-03 18:33

    Found the answer myself.

    In Swift 3 you can now mark a class as open instead of public this allows files outside of the module to subclass that class.

    Simply replace public in your module class with open.

    Reference here.

提交回复
热议问题