I create a runtime class and then swizzle an instance to be an instance of that new class.
MyClass *object = [MyClass new];
Class subclass = objc_allocateClassPair([MyClass class], "MyClass_RuntimeClass", 0);
objc_registerClassPair(subclass);
object_setClass(object, subclass);
This works fine. I can call methods and set properties defined on MyClass after swizzling.
The only problem is that the debugger no longer shows the properties of the object.
Apple seem to have overcome this issue with their KVO runtime classes.
I tried adding the properties on the new class using class_addProperty, but this fails as they are already defined.
Is there something I am missing?