Skip to content

Instantly share code, notes, and snippets.

@HeidiHansen
Created September 8, 2014 03:08
Show Gist options
  • Save HeidiHansen/ac09bf3a3ec1a0588dcc to your computer and use it in GitHub Desktop.
Save HeidiHansen/ac09bf3a3ec1a0588dcc to your computer and use it in GitHub Desktop.
Designated Initializers
- (instancetype)init
{
return [self initWithName:@""];
}
- (instancetype)initWithName:(NSString *)name
{
return [self initWithName:name
Gender:YES
AgeIs:@9
HeightIs:@9
withFriends:[[NSMutableArray alloc]init]];
}
- (instancetype)initWithName:(NSString *)name
Gender:(BOOL)isFemale
AgeIs:(NSNumber *)age
HeightIs:(NSNumber *)height
withFriends:(NSMutableArray *)friends;
{
self = [super init];
if (self) {
self.name=name;
_isFemale=isFemale;
_age=age;
_height=height;
_friends= friends;
}
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment