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 restorationidentifier objective-c selector restorationidentifier conflicts getter restorationidentifier superclass uiviewcontroller same 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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -