I'd like to extend a framework class (I don't want to edit the source code directly), and make it conform to NSCoding
.
Basically, here's a simplification of the situation I'm in :
/* Can't be edited. */
class Car: NSObject {
var color: String?
}
/* Can be edited */
extension Car: NSCoding {
init(coder aDecoder: NSCoder) {
}
func encodeWithCoder(aCoder: NSCoder) {
}
}
The issue is init(coder aDecoder: NSCoder)
is, as per the header file, a designated initializer
(isn't this weird though ? shouldn't it be a convenience initializer
?). However, the documentation says extension can't add a new designated initializer.
My English isn't perfect and maybe I missed something out... Or is it really impossible ?