You can declare functions as inlines like this:
#ifdef DEBUG void DPrintf(NSString *fmt,...); #else inline void DPrintf(NSString *fmt,...) {} #endif <
#ifdef DEBUG void DPrintf(NSString *fmt,...); #else inline void DPrintf(NSString *fmt,...) {} #endif
You can accomplish this with blocks
-(void)viewDidLoad { void(^inlineFunction)(int) = ^(int argument) { NSLog(@"%i", argument); }; inlineFunction(5);//logs '5' }
Apple even documents this here (archive) so it's not a private method as many online seem to believe.
Enjoy!