I'm having trouble understanding when to use properties in Objective C 2.0. It seems you do not need a property for a primitive type such as: int, bool, float. Is this true? I have seen examples showing properties for these types and other leaving them out. For example, in Apple's sample code they have:
...
@interface Book : NSObject {
// Primary key in the database.
NSInteger primaryKey;
// Attributes.
NSString *title;
NSDate *copyright;
NSString *author;
BOOL hydrated;
BOOL dirty;
NSData *data;
}
@property (assign, nonatomic, readonly) NSInteger primaryKey;
// The remaining attributes are copied rather than retained because they are value objects.
@property (copy, nonatomic) NSString *title;
@property (copy, nonatomic) NSDate *copyright;
@property (copy, nonatomic) NSString *author;
...
Apple SQLite Book List Sample Code
So as you can see they don't use a property for BOOL, but they treat it has an instance variable throughout the implementation file, reading the value and setting the value. Searching online I have found tutorials that do use properties for these types such as: (@property BOOL flag). Can someone shed some light on this topic for me? Thanks.