I have an existing document-based Core Data application that I converted to Swift 2 in Xcode 7. After converting the project, the compiler crashes every time I build the project. I narrowed the problem down to the convenience init method I override in my NSPersistentDocument subclass. If I comment out the init method, the project builds.
But if I have the convenience init method in my code, the compiler crashes, even if the only thing the init method does is call self's init method.
convenience init(type typeName: (String!)) {
self.init()
}
What changes do I have to make to the convenience init method to prevent the Swift compiler from crashing when building the project?
It looks like that NSDocument convenience intializer was changed to be this:
convenience init(type typeName: String) throws
The Swift compiler may not have liked the combination of the explicitly unwrapped optional and the lack of the throws keyword?
But in a playground in Xcode 7 beta 2 I just see a warning about overriding with the change to an optional, so if you aren't using beta 2 or beta 3, you'll probably want to download a newer beta.