3 ms·
This and the linked guides claim there is no advantage to using instance variables (preferring properties), but I see at least one advantage: simplicity. When
by jsankey 13y ago
This and the linked guides claim there is no advantage to using instance variables (preferring properties), but I see at least one advantage: simplicity. When you're reading code that uses an instance variable you know exactly what it's doing, you don't have to check the attributes of the property, or the getter/setter implementation, or think about any KVO going on.
I'm not saying this makes instance variables preferable, but there is something to be said for minimising the number of places you need to look when trying to understand a snippet of implementation.
- overcyn 13y agoExactly!!!! So much of objc programming is about maintaining internal state. Dot syntax and automatically synthesized properties just obfuscates whats actually going on. IMO you should always be accessing the ivar directly unless you have a specific reason not to.