GRequest alternatives and similar libraries
Based on the "Network" category.
Alternatively, view GRequest alternatives based on common mentions on social networks and blogs.
-
Perfect
Server-side Swift. The Perfect core toolset and framework for Swift Developers. (For mobile back-end development, website and API development, and moreβ¦) -
Reachability.swift
Replacement for Apple's Reachability re-written in Swift with closures -
swifter
Tiny http server engine written in Swift programming language. -
SwiftSoup
SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS) -
Netfox
A lightweight, one line setup, iOS / OSX network debugging library! π¦ -
SwiftHTTP
Thin wrapper around NSURLSession in swift. Simplifies HTTP requests. -
APIKit
Type-safe networking abstraction layer that associates request type with response type. -
CocoaMQTT
MQTT 5.0 client library for iOS and macOS written in Swift -
Swifton
A Ruby on Rails inspired Web Framework for Swift that runs on Linux and OS X -
Zewo
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines. -
ResponseDetective
Sherlock Holmes of the networking layer. :male_detective: -
SwiftWebSocket
A high performance WebSocket client library for swift. -
BlueSocket
Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux. -
Connectivity
π Makes Internet connectivity detection more robust by detecting Wi-Fi networks without Internet access. -
WKZombie
WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser. It can be used to run automated tests / snapshots and manipulate websites using Javascript. -
Pitaya
π A Swift HTTP / HTTPS networking library just incidentally execute on machines -
Blackfish
A minimal, fast and unopinionated web framework for Swift -
Express
Swift Express is a simple, yet unopinionated web application server written in Swift -
PeerKit
An open-source Swift framework for building event-driven, zero-config Multipeer Connectivity apps -
Heimdallr.swift
Easy to use OAuth 2 library for iOS, written in Swift. -
Socks
π Non-blocking TCP socket layer, with event-driven server and client. -
Embassy
Super lightweight async HTTP server library in pure Swift runs in iOS / MacOS / Linux -
Reach
A simple class to check for internet connection availability in Swift. -
Digger
Digger is a lightweight download framework that requires only one line of code to complete the file download task -
SOAPEngine
This generic SOAP client allows you to access web services using a your iOS app, Mac OS X app and AppleTV app. -
Transporter
A tiny library makes uploading and downloading easier -
SwiftyOAuth
A simple OAuth library for iOS with a built-in set of providers -
XcodeServerSDK
Access Xcode Server API with native Swift objects. -
BigBrother
Automatically sets the network activity indicator for any performed request.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of GRequest or a related project?
README
GRequest
An HTTP request library written in Swift.
Basic Usage
Be simple, as it should be:
Request("https://api.github.com/repos/lingoer/SwiftyJSON/issues").get{
response in
println(response.content)//HTTP Body as NSData
}
If you need more infomation:
Request("https://api.github.com/repos/lingoer/SwiftyJSON/issues").get{
response in
println(response.headers)
println(response.MIMEType)
println(response.statusCode)
println(response.encoding)
println(response.error)
println(response.content)//HTTP Body as NSData
println(response.string)//HTTP Body as String
println(response.object)//HTTP Body as Deserialized Custom Object, Default is NSData. See Below for more info
}
Use .query()
to pass parameters for GET methods
Request("www.example.com/api").query(["labels":"discuss"]).get{
response in
}
As for POST:
//This will encode body as application/x-www-form-urlencoded
Request("http://www.example.com").formBody(["key":"value"]).post{
response in
}
//This will encode body as application/json
Request("http://www.example.com").jsonBody(["key":"value"]).post{
response in
}
//You can custom your HTTP Body to POST, with Content-Type provided after it.
Request("http://www.example.com").body(customBodyData, typeString:"application/json; charset=utf-8").post{
response in
}
More:
Request("http://www.example.com").head{
response in
}
Request("http://www.example.com").put{
response in
}
Request("http://www.example.com").delete{
response in
}
Request("http://www.example.com").patch{
response in
}
Instances And Chainnings
A Request is in fact a GRequest<T>
It's typealias Request = GRequest<NSData>
as default.
And a GRequest
is a Generic class specifiying the behavior of the response.
Most methods returns an instance of the GRequest
to make chains.
For example .path()
:
Request("https://api.github.com").path("/repos/lingoer/SwiftyJSON/issues").get{
response in
}
Response Deserialization
As for the response behavior.
It's mostly about Response Deserialization:
Request("https://api.github.com/repos/lingoer/SwiftyJSON/issues").query(["labels":"discuss"]).get{
(response:GResponse<JSONValue>) in
println(response.object)//It's JSON Now
}
Note for more infomation about the JSONValue
, see SwiftyJSON
If you need something.Just specify it!
Request("https://www.google.com/images/srpr/logo11w.png").get{
(response:GResponse<UIImage>) in
let image:UIImage = response.object!
}
If you don't want to do that every time:
let client = GRequest<JSONValue>("http://api.example.com")
client.path("/path/to/resource").get{
response in
println(response.object) //Its JSON Now
}
Extensibility
You can add your custom implementation of your Model deserialization.
By extentions conform protocol: ResponseDeserialization
extension CustomModel:ResponseDeserialization{
class func convertFromData(data:NSData!) -> (CustomModel?, NSError?)
}
GRequest<CustomModel>("http://api.example.com").get{
response in
let model:CustomModel! = response.object
}