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

All superclasses get marked as having a subclass that is modified. #150

Open mislsl opened 6 years ago

mislsl commented 6 years ago

// Add the selector as being modified. currentClass = klass; AspectTracker parentTracker = nil; do { AspectTracker tracker = swizzledClassesDict[currentClass]; if (!tracker) { tracker = [[AspectTracker alloc] initWithTrackedClass:currentClass parent:parentTracker]; swizzledClassesDict[(id)currentClass] = tracker; } [tracker.selectorNames addObject:selectorName]; // All superclasses get marked as having a subclass that is modified. parentTracker = tracker; }while ((currentClass = class_getSuperclass(currentClass)));

Please tell me why I do it.

AController:UIViewController

BController:UIViewController

AController aspect: buttonClick

BCotroller aspect: buttonClick exception: Error: buttonClick already hooked in UIViewController