Created
August 25, 2017 16:44
-
-
Save ndurell/e74aae14303c040f7d9073f601a654ed to your computer and use it in GitHub Desktop.
Weak self example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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