Skip to content

Commit

Permalink
Call class method instead of private _keyPathsForValuesAffectingValue…
Browse files Browse the repository at this point in the history
…ForKey
  • Loading branch information
hmelder committed Oct 14, 2024
1 parent a37d9f9 commit bf40916
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/NSKVOSupport.m
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ - (bool)isEmpty
// Aggregate all keys whose values will affect us.
if (dependents)
{
NSSet *valueInfluencingKeys
= _keyPathsForValuesAffectingValueForKey([object class], key);
Class cls = [object class];
NSSet *valueInfluencingKeys = [cls keyPathsForValuesAffectingValueForKey: key];
if (valueInfluencingKeys.count > 0)
{
// affectedKeyObservers is the list of observers that must be notified
Expand Down Expand Up @@ -672,7 +672,7 @@ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key

+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key
{
return _keyPathsForValuesAffectingValueForKey(self, key) ?: [NSSet set];
return _keyPathsForValuesAffectingValueForKey(self, key) ?: [NSSet set]; // TODO(Hugo): Avoid constructing an empty set in every call
}

- (void)addObserver:(id)observer
Expand Down

0 comments on commit bf40916

Please sign in to comment.