Last active
August 29, 2015 13:56
-
-
Save r3econ/9124306 to your computer and use it in GitHub Desktop.
NSObject Extensions.
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 (Extensions) | |
- (void)performBlock:(void (^)(void))block | |
afterDelay:(NSTimeInterval)delay; | |
@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+Extensions.h" | |
@implementation NSObject (Extensions) | |
- (void)performBlock:(void (^)(void))block | |
afterDelay:(NSTimeInterval)delay | |
{ | |
block = [block copy]; | |
[self performSelector:@selector(fireBlockAfterDelay:) | |
withObject:block | |
afterDelay:delay]; | |
} | |
- (void)fireBlockAfterDelay:(void (^)(void))block | |
{ | |
block(); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment