Created
June 12, 2013 18:16
-
-
Save stevenharman/5767741 to your computer and use it in GitHub Desktop.
A `tap` method for Objective-C, as inspired by Ruby. Thanks, @coreyhaines.
This file contains 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
#import <Foundation/Foundation.h> | |
@interface NSObject (Tap) | |
- (id)tap:(void (^)(id))block; | |
@end |
This file contains 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
#import "NSObject+Tap.h" | |
@implementation NSObject (Tap) | |
- (id)tap:(void (^)(id))block | |
{ | |
block(self); | |
return self; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment