Skip to content

Commit

Permalink
Move implementation of new method to correct category
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Oct 1, 2023
1 parent bb5fa6c commit 875d966
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
11 changes: 6 additions & 5 deletions Headers/Foundation/NSKeyValueObserving.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,6 @@ GS_EXPORT NSString *const NSKeyValueChangeNotificationIsPriorKey;
- (void) removeObserver: (NSObject*)anObserver
forKeyPath: (NSString*)aPath
context: (void *)context;

- (void) removeObserver: (NSObject*)anObserver
fromObjectsAtIndexes: (NSIndexSet *)indexes
forKeyPath: (NSString*)aPath
context: (void *)context;
#endif
@end

Expand All @@ -162,6 +157,12 @@ GS_EXPORT NSString *const NSKeyValueChangeNotificationIsPriorKey;
fromObjectsAtIndexes: (NSIndexSet*)indexes
forKeyPath: (NSString*)aPath;

#if OS_API_VERSION(MAC_OS_X_VERSION_10_7,GS_API_LATEST)
- (void) removeObserver: (NSObject*)anObserver
fromObjectsAtIndexes: (NSIndexSet *)indexes
forKeyPath: (NSString*)aPath
context: (void *)context;
#endif
@end

/**
Expand Down
26 changes: 19 additions & 7 deletions Source/NSKeyValueObserving.m
Original file line number Diff line number Diff line change
Expand Up @@ -1631,13 +1631,6 @@ - (void) removeObserver: (NSObject*)anObserver
[kvoLock unlock];
}

- (void) removeObserver: (NSObject*)anObserver
fromObjectsAtIndexes: (NSIndexSet *)indexes
forKeyPath: (NSString*)aPath
context: (void *)context
{
}

@end

/**
Expand Down Expand Up @@ -1701,6 +1694,25 @@ - (void) removeObserver: (NSObject*)anObserver
}
}

- (void) removeObserver: (NSObject*)anObserver
fromObjectsAtIndexes: (NSIndexSet *)indexes
forKeyPath: (NSString*)aPath
context: (void *)context
{
NSUInteger i = [indexes firstIndex];

while (i != NSNotFound)
{
NSObject *elem = [self objectAtIndex: i];

[elem removeObserver: anObserver
forKeyPath: aPath
context: context];

i = [indexes indexGreaterThanIndex: i];
}
}

@end

/**
Expand Down

0 comments on commit 875d966

Please sign in to comment.