Skip to content

Instantly share code, notes, and snippets.

@vikitripathi
Created January 7, 2017 18:11
Show Gist options
  • Save vikitripathi/95f4b40bd657eec2dd62d3498e6c0df9 to your computer and use it in GitHub Desktop.
Save vikitripathi/95f4b40bd657eec2dd62d3498e6c0df9 to your computer and use it in GitHub Desktop.
dispatch_after a delay
- (void)signInWithUsername:(NSString *)username password:(NSString *)password complete:(RWSignInResponse)completeBlock {
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
BOOL success = [username isEqualToString:@"user"] && [password isEqualToString:@"password"];
completeBlock(success);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment