Network
Usage
Making a Request
import Network
Network.request("https://httpbin.org/get").build()
Network.request("https://httpbin.org/get").query(["foo": "bar"]).build()
Network.request("https://httpbin.org/get").headers(["Custom-Content-Type": "application/json; encrypted=1"]).build()
Network.request("https://httpbin.org/post").post(["foo": "bar"]).encoding(.URLEncodedInURL).build()
Network.request("https://httpbin.org/post").post(["foo": "bar"]).encoding(.JSON).retry(1).build()
Network.request("https://httpbin.org/post").post(["foo": "bar"]).encoding(.JSON).priority(Network.Priority.Low).build()
// Please take a look at Network.swift for more configuration
Response Handling
Network.request("https://httpbin.org/get").build()?.responseJSON { request, response, responseValue, error in
}
let (response, responseData, error) = Network.request("https://httpbin.org/post").query(["foo": "bar"]).post(["encode": "json"]).encoding(.JSON).syncResponseJSON()
Requirements
Installation
Network is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Network"
Author
Suen, [email protected]
License
Network is available under the MIT license. See the LICENSE file for more info.