- 
      
- 
        Save mysteriouspants/1453314 to your computer and use it in GitHub Desktop. 
    Madness.
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | @interface Sender : NSObject | |
| @property (weak) id delegate; | |
| @property (assign) SEL selector; | |
| - (void)doSth; | |
| @end | |
| @interface Receiver : NSObject | |
| @property (strong) Sender* whatever; | |
| @property (copy) void(^blockStuff)(); | |
| - (void)assumeThisIsRun; | |
| @end | |
| @implementation Sender | |
| @synthesize delegate=_delegate; | |
| @synthesize selector=_selector; | |
| - (void)doSth | |
| { | |
| [_delegate performSelector:_selector]; | |
| } | |
| @end | |
| @implementation Receiver | |
| @synthesize whatever=_whatever; | |
| @synthesize blockStuff=_blockStuff; | |
| - (void)assumeThisIsRun | |
| { | |
| self.whatever = [[Sender alloc] init]; | |
| self.blockStuff = ^{NSLog(@"Hello world!");}; | |
| _whatever.delegate = _blockStuff; | |
| _whatever.selector = @selector(startBlock); | |
| [_whatever doSth]; | |
| } | |
| @end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment