Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MAKVONotificationCenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ enum
@property(strong,readonly) id __attribute__((ns_returns_not_retained)) newValue;
@property(strong,readonly) NSIndexSet *indexes;
@property(assign,readonly) BOOL isPrior;
@property(assign, readonly) id<MAKVOObservation> observation;

@end

Expand Down
7 changes: 4 additions & 3 deletions MAKVONotificationCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ @interface MAKVONotification ()
NSDictionary *change;
}

- (id)initWithObserver:(id)observer_ object:(id)target_ keyPath:(NSString *)keyPath_ change:(NSDictionary *)change_;
- (id)initWithObserver:(id)observer_ object:(id)target_ keyPath:(NSString *)keyPath_ change:(NSDictionary *)change_ helper:(id<MAKVOObservation>)helper;

@property(copy,readwrite) NSString *keyPath;
@property(assign,readwrite) id observer, target;
Expand All @@ -37,14 +37,15 @@ @implementation MAKVONotification

@synthesize keyPath, observer, target;

- (id)initWithObserver:(id)observer_ object:(id)target_ keyPath:(NSString *)keyPath_ change:(NSDictionary *)change_
- (id)initWithObserver:(id)observer_ object:(id)target_ keyPath:(NSString *)keyPath_ change:(NSDictionary *)change_ helper:(id<MAKVOObservation>)helper
{
if ((self = [super init]))
{
self.observer = observer_;
self.target = target_;
self.keyPath = keyPath_;
change = change_;
_observation = helper;
}
return self;
}
Expand Down Expand Up @@ -142,7 +143,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N

// Pass object instead of _target as the notification object so that
// array observations will work as expected.
notification = [[MAKVONotification alloc] initWithObserver:_observer object:object keyPath:keyPath change:change];
notification = [[MAKVONotification alloc] initWithObserver:_observer object:object keyPath:keyPath change:change helper:self];
((void (^)(MAKVONotification *))_userInfo)(notification);
}
#endif
Expand Down