4 ms·
Read http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/ObjCAvailabilityIndex/index.html http://developer.apple.com/library/ios/#releasenotes/Objec
by hboon 14y ago
Read http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/ObjCAvailabilityIndex/index.html http://developer.apple.com/library/ios/#releasenotes/Objecti... and on a related note, read http://clang.llvm.org/docs/ObjectiveCLiterals.html http://clang.llvm.org/docs/ObjectiveCLiterals.html too.
You only need to synthesize when you access the variable directly.
I always access via properties unless I'm within a setter for that property or if I want to bypass my own lazy loading getter code. So I'm left with only a few occasional @synthesize statements in most classes.
And in Xcode, run Edit > Refactor > Convert to Modern Objective-C Syntax. I don't think it helps remove unnecessary @synthesize, but it sure helps with those super-double-extra-verbose-old-style container subscripting accesses.
- rimantas 14y ago> You only need to synthesize when you access the variable > directly. You don't. @property will take care about creating ivars. So with @property (strong, nonatomic) NSString *foo you get _foo and accessors. The only place I need @synthesize is in NSManagedObject subclasses.
- hboon 14y agoAh. I stand corrected. I @synthesize because I always want foo and not _foo.