I'm trying to write a custom macro that performs some action when called it.
Here is my constants file:
#define SHOW_VIEW [(AppDelegate*)[UIApplication sharedApplication].delegate showView]
#define HIDE_VIEW [(AppDelegate*)[UIApplication sharedApplication].delegate hideView]
// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
#endif /* MYPrefixHeader_pch */
Include your app delegate in the constants header
I would urge to reconsider this method to get more readable and consistent code. Instead, what you can do is define a macro for your app delegate instance.
#define MY_APP_DELEGATE ((AppDelegate *)[UIApplication sharedApplication].delegate)
Then call its methods directly:
[MY_APP_DELEGATE showView]; [MY_APP_DELEGATE hideView];