Skip to content

Instantly share code, notes, and snippets.

@ndurell
Created August 25, 2017 16:44
Show Gist options
  • Save ndurell/e74aae14303c040f7d9073f601a654ed to your computer and use it in GitHub Desktop.
Save ndurell/e74aae14303c040f7d9073f601a654ed to your computer and use it in GitHub Desktop.
Weak self example
create(image: image) { [weak self] key, error in
guard let `self` = self else {
return
}
if let error = error {
self.completion?(nil, error)
self.completion = nil
return
}
guard let key = key else {
self.completion?(nil, self.unknownError)
self.completion = nil
Logging.warn("Unable to upload image")
return
}
self.append(key: key, image: image, toAnnotation: annotation)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment