initialization - Why doesn't Swift force my designated initializer to call super? -


this code legal in swift:

class snapper : nsobject {     var anim : uidynamicanimator     init(referenceview:uiview) {         self.anim = uidynamicanimator(referenceview:referenceview)         // super.init()     } } 

observe in initializer didn't call super.init(); commented out line. swift compiler doesn't complain. why? thought there rule designated initializer must call designated initializer of superclass. , have superclass, namely nsobject.

is bug? or having nsobject superclass special case? if so, why? realize nsobject has no instance variables need initialization, how know init doesn't other things need doing? shouldn't swift giving compile error here?

it's not answer of why adding symbolic breakpoint on [nsobject init] shows gets called if super.init() commented out.

it seems special case replacing nsobject other class makes compiler warn again missing super call. guess the compiler handles special case given it's our base class 1 known designated initializer.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -