Skip to content

Instantly share code, notes, and snippets.

Avatar

diwup diwu

View GitHub Profile
@diwu
diwu / NavInjection.m
Last active Dec 31, 2015
A Quick Way Of Knowing Which View Controller You Are Pushing Into
View NavInjection.m
//A Quick Way Of Knowing Which View Controller You Are Pushing Into
//I find it extremely useful when debugging other team members' (unfamiliar) code
//Usage: Drop the snippet into a blank .m file. It'll NSLog when you are pushing a view controller.
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import <objc/message.h>
typedef void(^Block_IMP_pushViewController_animated)(__unsafe_unretained id _self, __unsafe_unretained id arg1, BOOL arg2);
static BOOL replaceMethodWithBlock(Class c, SEL origSEL, SEL newSEL, id block) {