ios - Provide default value for restorationIdentifier -
i want override restorationidentifier variable view controllers inheriting myviewcontroller have restorationidentifier set class names. however, seems swift not allow me doing this.
the var want overload , provide default implementation defined as:
var restorationidentifier: string? i tried overriding with:
class myviewcontroller : uiviewcontroller { override var restorationidentifier: string? { return nsstringfromclass(self.dynamictype).componentsseparatedbystring(".").last! } } compiler shouts @ me with:
getter
restorationidentifierobjective-c selectorrestorationidentifierconflicts getterrestorationidentifiersuperclassuiviewcontrollersame objective-c selector
how can overcome this?
you not defining setter, makes read-only property. code works me:
override var restorationidentifier: string? { { return nsstringfromclass(self.dynamictype).componentsseparatedbystring(".").last! } set(value) { super.restorationidentifier = value } }
Comments
Post a Comment