The Objective-C runtime allows you to dynamically create and register pairs of classes using objc_allocateClassPairand, objc_registerClassPairrespectively. Can I get a notification when a new class is added to the runtime? (I'm only interested in registered Objective-C classes, if that helps, unregistered classes will be a bonus.)
If it is not possible to receive a notice, what is the next most effective? Most iOS devices have severe computational limitations, so my options are limited. I am open to hacking at runtime, if that allows. I understand that I could just plug in +load, but this will only work with NSObject subclasses, not pure Swift classes.
"Pure Swift classes? But pure Swift classes are not Objective-C classes!" you say? Think again. Try exploring a pure Swift class using the runtime, and you will see that there is more to it than meets the eye! "How can I add a dynamic Swift class?" Well, I can just load the dynamic structure that uses Swift!
Since @SpaceDog asked, this is for the developer utility I'm working on. For further clarification: I do not know when objc_allocateClassPairor will be called objc_registerClassPair, since my project is a library.
source
share