RSSAmplifier

annema.me · Jan 14, 2014

Initializing Objective-C classes with sane initial state

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

Because Objective-C has the concept of designated initializers , you have to ensure your classes are instantiated using sane initial state. Take for example a fictitious person class with the designated initializer initWithName: @implementation Person - ( id ) initWithName : ( NSString * ) name ; { self = [ super init ] ; if ( self ) { _name = name ; } return self ; } @end Now in a view controller…

Read on annema.me

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.