Riaz
Riaz

Reputation: 43

Migrate Objective c To swift completionBlock

Some Body please help me to migrate this following code from objective C to swift2.

ccRegistrationVC.completionBlock = ^(BNCCRegCompletion completion, BNAuthorizedCreditCard *card){
    [self.navigationController popViewControllerAnimated:YES];
};

Upvotes: 0

Views: 65

Answers (1)

Erik Johansson
Erik Johansson

Reputation: 1248

full

ccRegistrationVC.completionBlock = { (completion: BNCCRegCompletion, card: BNAuthorizedCreditCard) in 
  self.navigationController.popViewControllerAnimated(true)
}

shorter

ccRegistrationVC.completionBlock = { 
  self.navigationController.popViewControllerAnimated(true)
}

You might need to add some unwraps on the navigationController line

Upvotes: 1

Related Questions