I know this question has been asked before but possibly not in the same context. My question is that I have a singleton class that is only dipatched_once in the lifetime of the app. In the class I have some methods that are accessing the instance variables and acting upon if they have been set on the instance. This is example of how I am attempting to access them:
// .m file:
Interface:
@property (nonatomic, assign, readwrite) BOOL userLoggedIn; Implementation: // method:
-(void)someMethod{ if(!_userLoggedIn){ } else { } } I know I can also use self to evaluate the value like this:
-(void)someMethod{ if(self.userLoggedIn){ } else { } } Wondering which is correct way of accessing the value? I am not synthesizing the properties since they are all declared in the interface only in the .m file. Thanks for the help!
-(BOOL)userLoggedIn{}implemented, that could change the behavior.userLoggedInis only defined for use in the implementation and you are using direct access to the variable, is there a reason you are declaring a property at all? Why not just use an instance variable (as in@implementation { BOOL userLoggedIn; } ...?