To execute the initialization code for a new document:
// Create new document (only called for new documents) convenience init?(type typeName: String, error outError: NSErrorPointer) { self.init() fileType = typeName // add your own initialisation for new document here }
The problem with Swift is that you cannot call the convenience initializer in super. Instead, you should delegate the designated initializer yourself. This means that you cannot take advantage of the superuser convenience initializers, and you must implement the initialization yourself, which means fileType = typeName above. As much as I like Swift, I find this nonsense: what's the point of reusing code that can be reused ??
source share