Created
February 1, 2013 13:27
-
-
Save rob-murray/4691299 to your computer and use it in GitHub Desktop.
An example of Objective C Global constant - shows class definition, implementation, import and usage
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
//Configuration.h | |
#import <Foundation/Foundation.h> | |
@interface Configuration : NSObject | |
extern NSString *const kRMAWebServiceURL; | |
extern const NSTimeInterval kRMTimeoutValue; | |
@end | |
//Configuration.m | |
#import "Configuration.h" | |
@implementation Configuration | |
NSString *const kRMAWebServiceURL = @"http://mywebservice.com"; | |
const NSTimeInterval kRMTimeoutValue = 90; | |
@end | |
// AppName-Prefix.pch | |
// ... // | |
#ifdef __OBJC__ | |
#import <UIKit/UIKit.h> | |
#import <Foundation/Foundation.h> | |
#import "Configuration.h" | |
#endif | |
// ... // | |
/* | |
* Usage | |
*/ | |
// Afile.m | |
- (void)aMethodThatDoesSomething | |
{ | |
NSLog(@"%@", kRMAWebServiceURL); | |
NSLog(@"%f", kRMTimeoutValue); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment