default.txt 755 B

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