Skip to content

Instantly share code, notes, and snippets.

View kenmhaggerty's full-sized avatar

Ken M. Haggerty kenmhaggerty

View GitHub Profile
@interface MyObject : NSManagedObject
@property (nonatomic, strong, nullable) NSSet *changedKeys;
@end
...
@interface MyObject
- (void)willSave {
[super willSave];
- (void)didSave {
[[NSNotificationCenter defaultCenter] postNotificationName:@"kPQSurveyDidSaveNotification" object:self userInfo:nil];
[super didSave];
}
- (void)setName:(NSString *)name {
NSString *primitiveName = [self primitiveValueForKey:NSStringFromSelector(@selector(name))];
if ((!name && !primitiveName) || [name isEqualToString:primitiveName]) {
return;
}
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (name) {
userInfo[@"object"] = name;