Cannot override initWithCoder in a view controller that is a type-specific subclass of a type-generic class
| Originator: | michele.titolo | ||
| Number: | rdar://23737814 | Date Originated: | 12/2/2015 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | iOS 9.1 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
A VC that is a type-specific subclass of a type-generic class cannot override initWithCoder.
Example:
class GenericViewController<T>: UIViewController {}
class PurpleViewController: GenericViewController<Int> {
required init?(coder aDecoder: NSCoder) {
print("Hello")
super.init(coder: aDecoder) // Value of type '_ -> _' has no member 'init'
}
}
class BlueViewController: UIViewController {
required init?(coder aDecoder: NSCoder) {
print("Hello")
super.init(coder: aDecoder)
}
}
Steps to Reproduce:
1. Paste the code above in a playground or application
2. Error! Value of type '_ -> _' has no member 'init'
Expected Results:
I expect to be able to override initWithCoder for any UIVC subclass
Actual Results:
The compiler throws a error
Version:
iOS 9.1 & Xcode 7.1
Notes:
Configuration:
All
Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!