KWFutureObject.m 731 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // KWFutureObject.m
  3. // iOSFalconCore
  4. //
  5. // Created by Luke Redpath on 13/01/2011.
  6. // Copyright 2011 LJR Software Limited. All rights reserved.
  7. //
  8. #import "KWFutureObject.h"
  9. @interface KWFutureObject()
  10. @property (nonatomic, strong) KWFutureObjectBlock block;
  11. @end
  12. @implementation KWFutureObject
  13. + (id)objectWithObjectPointer:(id __autoreleasing *)pointer {
  14. return [self futureObjectWithBlock:^{ return *pointer; }];
  15. }
  16. + (id)futureObjectWithBlock:(KWFutureObjectBlock)block {
  17. return [[self alloc] initWithBlock:block];
  18. }
  19. - (id)initWithBlock:(KWFutureObjectBlock)aBlock {
  20. self = [super init];
  21. if (self) {
  22. _block = [aBlock copy];
  23. }
  24. return self;
  25. }
  26. - (id)object; {
  27. return self.block();
  28. }
  29. @end