ios Swift fatal error: use of unimplemented initializer 'init()'
“Unlike subclasses in Objective-C, Swift subclasses do not inherit their superclass initializers by default.”
Automatic Initializer Inheritance
- Rule 1: If your subclass doesn’t define any designated initializers, it automatically inherits all of its superclass designated initializers.
- Rule 2: If your subclass provides an implementation of all of its superclass designated initializers—either by inheriting them as per rule 1, or by providing a custom implementation as part of its definition—then it automatically inherits all of the superclass convenience initializers.
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/tw/jEUH0.l
Since you have override the init(coder aDecoder: NSCoder)
, TimeLineTableViewController
won't have the init()
initiailzer.
You can provide an implementation of all of its superclass designated initialisers like this
override init() {
super.init()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
, or just delete the implementation of init(coder aDecoder: NSCoder)
.