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;
}
If you don't want to block the main thread in the case that
NO
should be returned after 5 sec delay, then structure that API asynchronously.To use: