Skip to content

Instantly share code, notes, and snippets.

@davepatterson
Created January 7, 2016 14:25
Show Gist options
  • Save davepatterson/54b25bc910d7b8de9cf4 to your computer and use it in GitHub Desktop.
Save davepatterson/54b25bc910d7b8de9cf4 to your computer and use it in GitHub Desktop.
Simple Swift Closure
class example {
func closureExample(completion:(status: Bool) -> Void) {
Alamofire.request(.GET, "").responseJSON { in response, result, data
if response {
completion(true)
} else {
completion(false)
}
// response ? completion(true) : completion(false)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment