I have a private class (both declared & defined within .m) as an addition to an implementation of a different class, that happens to use that private class internally.
I'd like to swizzle one of the methods of that private class.
I defined a category and did the usual:
+(void)load
{
Method original, swizzled;
original = class_getInstanceMethod(objc_getClass("SomePrivateClass"), @selector(somePrivateMethod:));
swizzled = class_getInstanceMethod(self, @selector(swizzled_somePrivateMethod:));
method_exchangeImplementations(original, swizzled);
}
The issue is that my implementation obviously doesn't know anything about this private class and self refers to the class I am adding the category to, whichever class that might be. So I have no way of calling the original implementation and in general working with the private class.
What is the proper approach to tackle this?