Objective c - Run block of code for X seconds but return immediately if
condition satisfies
So the situation is I need to run the code for 5 seconds but if I match
the condition then want it to immediately return back. I am doing this in
KIF test steps and I don't want this to block my applications main thread.
Sample pseudo Code -
+ (BOOL) isVerified:(NSString*)label;
{
if(<condition match>)
return YES;
else if(X seconds not passed)
<make sure m running this function for X seconds>
else // X seconds passed now..
return NO;
}
No comments:
Post a Comment