Skip to content

Instantly share code, notes, and snippets.

@sisoje
Last active February 1, 2019 13:47
Show Gist options
  • Save sisoje/1565b37a6ad3f2390f02ad5a6bf0bcfc to your computer and use it in GitHub Desktop.
Save sisoje/1565b37a6ad3f2390f02ad5a6bf0bcfc to your computer and use it in GitHub Desktop.
Resource acquisition is initialization (RAII) in Swift: Example
extension Timer {
var invalidation: DeinitBlock {
return DeinitBlock { [weak self] in
self?.invalidate()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment