Skip to content

Instantly share code, notes, and snippets.

@cxa
Last active December 11, 2015 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cxa/4647275 to your computer and use it in GitHub Desktop.
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`.
#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