I'm trying to understand how to use Bindings in Xcode. I have this class:
#import <Foundation/Foundation.h>
@interface OddsItem : NSObject {
NSMutableDictionary *properties;
}
@property(nonatomic, retain) NSMutableDictionary *properties;
@end
and
#import "OddsItem.h"
@implementation OddsItem {
}
@synthesize properties;
- (void)dealloc {
[properties release];
[super dealloc];
}
@end
Is this KVC-compliant? The examples I've found seem to be from before the days of synthesized properties.
If it isn't KVC-compliant what must I do to make it so?
The generated methods from @synthesized
are KVO-comliant.
As long as you change the property using the setter method it will be KVO-compliant.
If however you change the instance variable directly it won't be. In that case you will have to manually call willChangeValueForKey:
and didChangeValueForKey:
.