Last active
December 11, 2015 19:18
-
-
Save cxa/4647275 to your computer and use it in GitHub Desktop.
Is there a one-step solution for line 10? Currently I must assign a compiler flag to a .m file with `-DCOMPILE_ONCE`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef __OBJC__ | |
#import <Foundation/Foundation.h> | |
#define BUNDLE_NAME CXAFileManagerResourceBundle | |
extern NSBundle *BUNDLE_NAME; | |
#undef NSLocalizedString | |
#define NSLocalizedString(key, comment) [BUNDLE_NAME localizedStringForKey:(key) value:@"" table:nil] | |
#ifdef COMPILE_ONCE | |
NSBundle *BUNDLE_NAME; | |
@interface CXAResourceBundleLoader : NSObject @end | |
@implementation CXAResourceBundleLoader | |
+ (void)load | |
{ | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
BUNDLE_NAME = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"CXAFMResources" withExtension:@"bundle"]]; | |
}); | |
} | |
@end | |
#endif | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment