Last active
January 4, 2016 16:09
-
-
Save albertodebortoli/8645930 to your computer and use it in GitHub Desktop.
Macro to test asynchronous Objective-C code
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
| #define FutureConditionToBreakWithTimeout(_condition_, _duration_) \ | |
| NSDate *loopUntil = [NSDate dateWithTimeIntervalSinceNow:_duration_]; \ | |
| while (!_condition_ && [loopUntil timeIntervalSinceNow] > 0) { \ | |
| [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:loopUntil]; \ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment