[swift] setup Closure with returning void for Method A -> B sequentially

Setup Closure with returning void for Method A -> B sequentially
for that, refer below code

 

func saveName(name: String, completion: (()->Void)?) {
    
    //Save Name Method , etc
    
    //Completion Notification
    completion?()

  }

Run code is below

saveName(name: nameToSave){
    //Once complet saveName method, Reload tableview
    self.tableView.reloadData()
}

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です