Skip to content

Instantly share code, notes, and snippets.

@cxa
Last active Dec 11, 2015
Embed
What would you like to do?
Is there a one-step solution for line 10? Currently I must assign a compiler flag to a .m file with `-DCOMPILE_ONCE`.
#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