12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #import <UIKit/UIKit.h>
- #import "Dependency.h"
- @protocol WorldDataSource
- @optional
- - (NSString*)worldName;
- @required
- - (BOOL)allowsToLive;
- @end
- @interface Test : NSObject <HelloDelegate, WorldDataSource> {
- NSString *_greeting;
- }
- @property (nonatomic, readonly) NSString *greeting;
- - (IBAction) show;
- @end
- @implementation Test
- @synthesize test=_test;
- + (id) test {
- return [self testWithGreeting:@"Hello, world!\nFoo bar!"];
- }
- + (id) testWithGreeting:(NSString*)greeting {
- return [[[self alloc] initWithGreeting:greeting] autorelease];
- }
- - (id) initWithGreeting:(NSString*)greeting {
- if ( (self = [super init]) ) {
- _greeting = [greeting retain];
- }
- return self;
- }
- - (void) dealloc {
- [_greeting release];
- [super dealloc];
- }
- @end
|