Skip to content

Instantly share code, notes, and snippets.

@ayanonagon
Last active November 19, 2015 02:29
Show Gist options
  • Save ayanonagon/fbb7f87014778818fc61 to your computer and use it in GitHub Desktop.
Save ayanonagon/fbb7f87014778818fc61 to your computer and use it in GitHub Desktop.
enum Result<T> {
case Success(T)
case Error(NSError)
}
func listMessages(completion: Result<[Message]> -> Void) {
// Get the list of messages
// If success, call completion(Result.Success(messages))
// If error, call completion(Result.Error(error))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment