Arrête de cracker, instancie un Crackers !
Stop to get worked up, use Crackers ! Crackers is an HTTP networking library written in Swift, for OSX and iOS.
- HTTP methods : GET, POST, PUT, DELETE
- Asynchronous request
- Management of large packets
- HTTP Basic Authentication
let requestGet = Crackers(url: "http://httpbin.org/get")
requestGet.sendRequest(.GET, blockCompletion: { (data, response, error) -> () in
if (error == nil) {
println("request success ! \(response), \(data)")
}
else {
println("\(error)")
}
})
let requestPost = Crackers(url: "http://httpbin.org/post")
var parameters = Dictionary<String, String>()
parameters["username"] = "remi"
parameters["password"] = "github"
requestPost.setParameters(parameters)
requestPost.setHeader("application/json", headerField: "Content-Type")
requestPost.sendRequest(.POST, blockCompletion: { (data, response, error) -> () in
if (error == nil) {
println("request success ! \(response), \(data)")
}
else {
println("\(error)")
}
})
let requestGet = Crackers(url: "http://httpbin.org/get")
requestGet.setAutorizationHeader("remi", "github")
requestGet.sendRequest(.POST, blockCompletion: { (data, response, error) -> () in
if (error == nil) {
println("request success ! \(response), \(data)")
}
else {
println("\(error)")
}
})
Currently used in a personnal work.
Rémi ROBERT, remirobert33530@gmail.com Crackers is available under the MIT license. See the LICENSE file for more info.