"Cannot inherit from non-open class" swift

LOP_Luke picture LOP_Luke · Aug 16, 2016 · Viewed 15.8k times · Source

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 part of a separate Swift framework but my project compiled for Xcode 8 beta 5. What do I need to change to get my project to compile again?

Answer

LOP_Luke picture LOP_Luke · Aug 16, 2016

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.