Created
January 12, 2017 20:50
-
-
Save petermolnar-dev/5bfb33f8f498b66d5810e237821930b5 to your computer and use it in GitHub Desktop.
myObject.m - With convenience initializer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface MyObject() | |
@property (nonatomic) BOOL isNightMode | |
@property (strong, nonatomic) MyOtherObject *theObjectDoingSomethingElse | |
@end | |
@implementation MyObject | |
#pragma mark - Initializers | |
//2 | |
- (instancetype)initWithTheOtherObjectDoingSomethingElse:(MyOtherObject *)alreadyExisitingObject isNightModeOn:(BOOL)isNightMode { | |
self= [super init]; | |
if (self) { | |
_isNightMode = isNightMode; | |
_theObjectDoingSomethingElse = alreadyExisitingObject; | |
} | |
} | |
- (instancetype)initWithTheOtherObjectDoingSomethingElse:(MyOtherObject *)alreadyExisitingObject { | |
return [self initWithTheOtherObjectDoingSomethingElse:alreadyExisitingObject isNightModeOn:NO]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment