The objective c code seems like this:
- (void)signInAccountWithUserName:(NSString *)userName password:(NSString *)password completion:(void (^)(BOOL success))completionBlock { // Log into the account with `userName` and `password`... // BOOL loginSuccessful = [LoginManager contrivedLoginMethod]; // Notice that we are passing a BOOL back to the completion block. if (completionBlock != nil) completionBlock(loginSuccessful); } and this method usage is:
[self signInAccountWithUserName:@"Bob" password:@"BobsPassword" completion:^(BOOL success) { if (success) { [self displayBalance]; } else { // Could not log in. Display alert to user. } }]; How can I implement it in Swift? What is the equivalent implementation?