We have received a HUGE project from outsourcing that we are trying to \"repair\". There are hundreds of view controllers within the project. Our goal is to
The answer is to swizzle the methods! Here is what we came up with:
#import "UIViewController+Logging.h"
#import
@implementation UIViewController (Logging)
-(void)swizzled_viewDidAppear:(BOOL)animated
{
NSLog(@"Current View Class: %@", NSStringFromClass(self.class));
[self swizzled_viewDidAppear:animated];
}
+ (void)load
{
Method original, swizzled;
original = class_getInstanceMethod(self, @selector(viewDidAppear:));
swizzled = class_getInstanceMethod(self, @selector(swizzled_viewDidAppear:));
method_exchangeImplementations(original, swizzled);
}
@end