Skip to content

Instantly share code, notes, and snippets.

@deanashton
deanashton / UISwiftRestDemo.swift
Created July 26, 2016 07:46 — forked from cmoulton/UISwiftRestDemo
Quick & dirty REST API calls with Swift. See http://grokswift.com/simple-rest-with-swift/
// MARK: Using NSURLSession
// Get first todo item
let todoEndpoint: String = "http://jsonplaceholder.typicode.com/todos/1"
guard let url = NSURL(string: todoEndpoint) else {
print("Error: cannot create URL")
return
}
let urlRequest = NSURLRequest(URL: url)

Keybase proof

I hereby claim:

  • I am deanashton on github.
  • I am deanashton (https://keybase.io/deanashton) on keybase.
  • I have a public key whose fingerprint is 7DA6 B54A B844 D909 8EF7 F8B6 6440 D8F1 C626 F728

To claim this, I am signing this object: