Skip to content

Instantly share code, notes, and snippets.

@dodikk
Created December 16, 2016 15:41
Show Gist options
  • Select an option

  • Save dodikk/201ceae6eeafc817edab5338510c257e to your computer and use it in GitHub Desktop.

Select an option

Save dodikk/201ceae6eeafc817edab5338510c257e to your computer and use it in GitHub Desktop.
example of weak usage for swift closures
FriendsProvider.shared.getFriendList(){ success in
print("users Fetched \(success)")
dispatch_async(dispatch_get_main_queue(), {
self.delegate?.hideProgressHUD()
})
}
dispatch_async(dispatch_get_main_queue(), {
[weak self] in
if let strongSelf = self
{
strongSelf.delegate?.hideProgressHUD()
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment