CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Mar 2015 |
SPMSupports SPM | ✗ |
Maintained by Ricky Robinett.
SwiftRequest is a simple HTTP client for Swift. It was inspired by the Node.js Request library and Python Requests.
var swiftRequest = SwiftRequest()
swiftRequest.get("https://en.wikipedia.org/wiki/Brooklyn", callback: {err, response, body in
if( err == nil ) {
println(body)
}
})
Drop the SwiftRequest folder into your Xcode project.
var swiftRequest = SwiftRequest()
swiftRequest.get("http://news.ycombinator.com", callback: {err, response, body in
if( err == nil ) {
println(body)
}
})
swiftRequest.get("http://pokeapi.co/api/v1/pokemon/", params: ["limit":"5"], callback: {err, response, body in
if( err == nil ) {
println(body)
}
})
swiftRequest.get("https://api.github.com/user", auth: ["username" : "user", "password" : "pass"],callback: {err, response, body in
if( err == nil ) {
println(body)
}
})
var swiftRequest = SwiftRequest()
var data = [
"Name" : "Ricky",
"Favorite Band" : "Refused",
"Age" : "29"
]
swiftRequest.post("http://requestb.in/ukfc8euk", data: data, callback: {err, response, body in
if( err == nil ) {
println(body)
}
})
var swiftRequest = SwiftRequest()
swiftRequest.get("http://graphics8.nytimes.com/images/2013/02/22/nyregion/KENTILE-01/KENTILE-01-articleLarge.jpg", {err, response, body in
println(body)
var image = UIImage(data: body as NSData)
self.imageView.image = image
})