From bf4091684f54b91e658bd5ce55b2ec0f816eec11 Mon Sep 17 00:00:00 2001 From: hmelder Date: Mon, 14 Oct 2024 11:33:06 +0200 Subject: [PATCH] Call class method instead of private _keyPathsForValuesAffectingValueForKey --- Source/NSKVOSupport.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/NSKVOSupport.m b/Source/NSKVOSupport.m index c168a9372..cc3452f70 100644 --- a/Source/NSKVOSupport.m +++ b/Source/NSKVOSupport.m @@ -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 @@ -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