I would like to implement init(coder aDecoder: NSCoder!) in a superclass, and use it in all subclasses by calling a class method on the particular subclass in t
dynamicType is deprecated in Swift 3. We must use type(of:).
So Antonio's example is now:
class Base {
class func dummyDict() -> [String: String] {
return ["base1": "val1"]
}
init() {
for (key, value) in type(of: self).dummyDict() {
print("encoding \(value) for key \(key)")
}
}
}
class Subclass1 : Base {
override class func dummyDict() -> [String: String] {
return ["subclass1": "sub1"]
}
}