z4h4uw
Last Updated: February 25, 2016
·
4.07K
· sergigracia
Sergi2

Share your App Delegate as project constant

Define your AppDelegate as project constant in your Project-Prefix.pch file:

#ifdef __OBJC__
    //...
    #import "YourAppDelegate.h"
    #define SharedAppDelegate ((YourAppDelegate *)[[UIApplication sharedApplication] delegate])
#endif

And now you can access to your AppDelegate methods from any project file this way:

[SharedAppDelegate myMethod];
Say Thanks
Respond