Ok, so lately I got this supposedly bad habit of declaring my class properties with @property create getters and setters with @synthesize and just use them anywhere I need them, like self.name without reference to internal ivar ( let @synthesize do its job)
Now, of course, this does not allow me to access the internal ivar (for example, name_ ), but from what I have encoded so far, I really do not need it. For read-only properties, I do not use @synthesize , but I implement getter myself.
Everything seems fine, but for some reason I have the feeling that it is wrong, because all the open source libraries that I looked at also declared ivar and used it in all the code. @property + @synthesize and no ivar is certainly a lazy choice, but what are the disadvantages? Can anyone give me some advice?
In addition, I read that, as a general tip, you can use self.propertyName anywhere in your class code except for the dealloc and init methods. But until you make sure that the object is initialized:
-(id) init { if( (self=[super init] )) { } return self; }
and you delete all the observers with the key before calling [super dealloc] everything should be fine. Right?
source share