I want to override the restorationIdentifier variable so all view controllers inheriting from MyViewController have the restorationIdentifier set to their class names. However, it seems like Swift will not allow me doing this.
The var I want to overload and provide default implementation is defined as:
var restorationIdentifier: String?
I tried overriding it with:
class MyViewController : UIViewController {
override var restorationIdentifier: String? {
return NSStringFromClass(self.dynamicType).componentsSeparatedByString(".").last!
}
}
Compiler shouts at me with:
Getter for
restorationIdentifierwith Objective-C selectorrestorationIdentifierconflicts with getter forrestorationIdentifierfrom superclassUIViewControllerwith the same Objective-C selector
How can I overcome this?