Skip to content

Instantly share code, notes, and snippets.

@yutailang0119
Last active January 5, 2017 10:45
Show Gist options
  • Save yutailang0119/220e04bf92b96581dd8e4f74b0104817 to your computer and use it in GitHub Desktop.
Save yutailang0119/220e04bf92b96581dd8e4f74b0104817 to your computer and use it in GitHub Desktop.
Swift3.0で `dispatch_async` が使えなくなると聞いて
// Swift2.x
dispatch_async(dispatch_get_main_queue()) { [weak self]() in
if let weakSelf = self {
weakSelf.tableView.reloadData()
}
}
//Swift3.0
DispatchQueue.main.async { [weak self] in
if weakSelf = self {
self.tableView.reloadData()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment