I need to swizzle a class that I don't have a reference to at the point I'm trying to swizzle at. I'm using the "indie" swizzling method so that I can swizzle any class from anywhere, but it requires an instance of that class to get the Class
reference.
So the example code has this line:
Class class = [NSURLSession sharedSession].class;
However, I need to do something like:
Class class = classof(ViewController); //ViewController is a class, not an instance
Or something like that. Is this possible in ObjectiveC?
You do it the exact same way :
Class class = ViewController.class;