Reputation: 746
Like a doop I'd been declaring Instant Variables (iVar) and then @property in the interface .h file for a while now.
@interface MainGameViewController : UIViewController {
UserFactorsViewController *userFactorsViewController;
UITableView *myTableView;
}
@property (nonatomic, retain) UserFactorsViewController *userFactorsViewController;
@property (nonatomic, retain) IBOutlet UITableView *myTableView;
Under Automatic Reference Counting, should I just dispense with iVar and go all @property? Should I even have the word "retain" in property? What if I'm deploying for iOS 4.3, should I still use ARC?
Upvotes: 9
Views: 6433
Reputation: 3634
Don't feel like a doop, even though the compiler will add ivars for you if you don't include them, many people still declare them (many book authors as well) to make the code a little bit easier to read (easier to distinguish between ivar and property).
When creating a property now, Apple wants you to think in terms of Object Graphs, so do some research on "strong" and "weak" property attributes instead of retain and releases.
Also, iOS 4 is setup as a target for ARC so you should be ok. But I believe if you wanted to support iOS 3.0 you would have to manually manage retain and releases as before.
Upvotes: 10