I see it recommended all over the place when coding for iOS that properties should be used for accessing instance variables because of the benefits this lends to memory management, among other things.
This advice doesn't sit terribly well with me. I find that using properties instead of plain old ivars just takes too much code and I don't really see the benefits if you're comfortable with memory management. Is it really that important? What's your approach to managing instance variables?
It's not really necessary to declare properties for all ivars. A few points come to mind:
init
and then release as necessary during dealloc
.So I generally use properties, but for things like a NSMutableArray
that an object allocates during init
and uses to hold a bunch of whatevers, I'll use a plain old ivar since I'll never be reassigning the ivar.