steipete / Aspects

Delightful, simple library for aspect oriented programming in Objective-C and Swift.
https://twitter.com/steipete
MIT License
8.4k stars 1.26k forks source link

aspect_deregisterTrackedSelector #113

Open hejunm opened 7 years ago

hejunm commented 7 years ago

In aspect_deregisterTrackedSelector(id self, SEL selector){} method,
after perform the code below,

if (tracker.selectorNames.count == 0 && tracker.selectorNamesToSubclassTrackers) {
     [swizzledClassesDict removeObjectForKey:currentClass];
 }

aspect can't promise " A method can only be hooked once per class hierarchy." I think the code should be:

 if (tracker.selectorNames.count == 0 && tracker.selectorNamesToSubclassTrackers.count == 0) {
    [swizzledClassesDict removeObjectForKey:currentClass];
 }