I can't seem to extend a class from cocoapod ra1028/Former in my application with the right initializers from the parent class. Why is this?
See below situation divided into the code from the pod and my application code (ExtendedFormLabelHeaderView class)
// ra1028/Former cocaopod class signatures
public protocol FormableView: class {}
public protocol LabelFormableView: FormableView {}
open class FormHeaderFooterView: UITableViewHeaderFooterView {
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override public init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)
}
}
open class FormLabelHeaderView: FormHeaderFooterView, LabelFormableView {
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override public init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)
}
}
// my app code
open class ExtendedFormLabelHeaderView: FormLabelHeaderView {
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override public init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)
}
}
Running above code in the playground works.
But running it as setup in my workspace (coming from Swift 2.2, converted to Swift 3) it will first complain about ExtendedFormLabelHeaderView's override init(reuseIdentifier: String?)
initializer not being public (most likely because it cannot find the initializer it needs to override?) and then I end up with these error messages:
Initializer does not override a designated initializer from its superclass.
Argument labels '(reuseIdentifier:)' do not match any available overloads
Some other things to note:
- It worked back in 2.2
- I updated Former to the latest Swift 3.0 version
- Removing the
override
keyword from the offending initializer in my ExtendedFormLabelHeaderView class will give a different error for the first line:Initializer 'init(reuseIdentifier:)' with Objective-C selector initWithReuseIdentifier:' conflicts with implicit initializer 'init(reuseIdentifier:)' from superclass