| 1 |
#import <UIKit/UIKit.h> |
| 2 |
#import "Dependency.h" |
| 3 |
|
| 4 |
@protocol WorldDataSource |
| 5 |
@optional |
| 6 |
- (NSString*)worldName; |
| 7 |
@required |
| 8 |
- (BOOL)allowsToLive; |
| 9 |
@end |
| 10 |
|
| 11 |
@interface Test : NSObject <HelloDelegate, WorldDataSource> { |
| 12 |
NSString *_greeting; |
| 13 |
} |
| 14 |
|
| 15 |
@property (nonatomic, readonly) NSString *greeting; |
| 16 |
- (IBAction) show; |
| 17 |
@end |
| 18 |
|
| 19 |
@implementation Test |
| 20 |
|
| 21 |
@synthesize test=_test; |
| 22 |
|
| 23 |
+ (id) test { |
| 24 |
return [self testWithGreeting:@"Hello, world!\nFoo bar!"]; |
| 25 |
} |
| 26 |
|
| 27 |
+ (id) testWithGreeting:(NSString*)greeting { |
| 28 |
return [[[self alloc] initWithGreeting:greeting] autorelease]; |
| 29 |
} |
| 30 |
|
| 31 |
- (id) initWithGreeting:(NSString*)greeting { |
| 32 |
if ( (self = [super init]) ) { |
| 33 |
_greeting = [greeting retain]; |
| 34 |
} |
| 35 |
return self; |
| 36 |
} |
| 37 |
|
| 38 |
- (void) dealloc { |
| 39 |
[_greeting release]; |
| 40 |
[super dealloc]; |
| 41 |
} |
| 42 |
|
| 43 |
@end |