agent alternatives and similar libraries
Based on the "Networking" category.
Alternatively, view agent alternatives based on common mentions on social networks and blogs.
-
AFNetworking
A delightful networking framework for iOS, macOS, watchOS, and tvOS. -
CocoaAsyncSocket
Asynchronous socket networking library for Mac and iOS -
RestKit
RestKit is a framework for consuming and modeling RESTful web resources on iOS and OS X -
Reachability.swift
Replacement for Apple's Reachability re-written in Swift with closures -
YTKNetwork
YTKNetwork is a high level request util based on AFNetworking. -
ASIHTTPRequest
Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone -
swift-protobuf
Plugin and runtime library for using protobuf with Swift -
apollo-ios
๐ฑ ย A strongly-typed, caching GraphQL client for iOS, written in Swift. -
RealReachability
We need to observe the REAL reachability of network. That's what RealReachability do. -
Netfox
A lightweight, one line setup, iOS / OSX network debugging library! ๐ฆ -
MonkeyKing
MonkeyKing helps you to post messages to Chinese Social Networks. -
SwiftHTTP
Thin wrapper around NSURLSession in swift. Simplifies HTTP requests. -
APIKit
Type-safe networking abstraction layer that associates request type with response type. -
ResponseDetective
Sherlock Holmes of the networking layer. :male_detective: -
Networking
Easy HTTP Networking in Swift a NSURLSession wrapper with image caching support -
XMNetworking
A lightweight but powerful network library with simplified and expressive syntax based on AFNetworking. -
Pitaya
๐ A Swift HTTP / HTTPS networking library just incidentally execute on machines -
SOAPEngine
This generic SOAP client allows you to access web services using a your iOS app, Mac OS X app and AppleTV app. -
Digger
Digger is a lightweight download framework that requires only one line of code to complete the file download task -
TWRDownloadManager
A modern download manager based on NSURLSession to deal with asynchronous downloading, management and persistence of multiple files. -
Restofire
Restofire is a protocol oriented networking client for Alamofire -
ws โ๏ธ
โ ๏ธ Deprecated - (in favour of Networking) :cloud: Elegantly connect to a JSON api. (Alamofire + Promises + JSON Parsing) -
EVURLCache
a NSURLCache subclass for handling all web requests that use NSURLRequest -
AFNetworking+RetryPolicy
Nice category that adds the ability to set the retry interval, retry count and progressiveness. -
MultiPeer
๐ฑ๐ฒ A wrapper for the MultipeerConnectivity framework for automatic offline data transmission between devices -
AFNetworking-Synchronous
Synchronous requests for AFNetworking 1.x, 2.x, and 3.x
Appwrite - The open-source backend cloud platform
* 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 agent or a related project?
Popular Comparisons
README
Agent
Table of Contents
Minimalistic Swift HTTP request agent for iOS and OS X.
Introduction
This is a tiny framework that gives you nice a API for crafting HTTP requests.
While Agent is mainly for JSON it also lets you send and access the raw data of a request and response. However if you are looking for a more feature complete library please take a look at Alamofire.
Usage
Throughout this documentation req
is used as an instance of Agent.
HTTP Verbs
The Agent API is simple and easy to use. Simply use Agent.<verb>(url)
and
you're good to go.
Overloading
It's possible to perform an entire request with a single call. Supply the required parameters when first creating the request. There are usually multiple degrees of overloading.
let done = { (response: NSHTTPURLResponse?, data: AnyObject?, error: NSError?) -> Void in
// react to the result of your request
};
Agent.post("http://example.com", headers: [ "Header": "Value" ],
data: [ "Key": "Value" ], done: done)
It's possible to omit most overloaded parameters such as headers
.
Method Chaining
Every Agent method returns the Agent itself, therefore it is possible to write more expressive code.
Agent.post("http://example.com")
.send([ "Key": "Value" ])
.end({ (response: NSHTTPURLResponse?, data: AnyObject?, error: NSError?) -> Void in
// react to the result of your request
}
)
Response Closure
One of the features that makes Agent is the response closure, instead of setting up a delegate for every HTTP request you have to make. You can simply react to the response in a closure.
In Agent, the response is of the type (response: NSHTTPURLResponse!, data: Agent.Data!, error: NSError!)
.
A response closure that reads JSON is easily created as seen below.
let done = { (response: NSHTTPURLResponse!, data: Agent.Data!, error: NSError!) -> Void in
let json = data! as Dictionary<String, String>
println(json["Key"]!)
}
Verbs
GET(url: String)
let req = Agent.get("http://example.com")
req.end({ (response: NSHTTPURLResponse?, data: AnyObject?, error: NSError?) -> Void in
// react to the result of your request
})
POST(url: String)
let req = Agent.post("http://example.com")
req.send([ย "Key": "Value" ])
req.end({ (response: NSHTTPURLResponse?, data: AnyObject?, error: NSError?) -> Void in
// react to the result of your request
})
PUT(url: String)
let req = Agent.put("http://example.com")
req.send([ย "Key": "Value" ])
req.end({ (response: NSHTTPURLResponse?, data: AnyObject?, error: NSError?) -> Void in
// react to the result of your request
})
DELETE(url: String)
let req = Agent.delete("http://example.com")
req.end({ (response: NSHTTPURLResponse?, data: AnyObject?, error: NSError?) -> Void in
// react to the result of your request
})
Methods
send(data: AnyObject) -> Agent
Will JSON serialize any data
and send it along as the HTTP body. Also
implicitly sets the Content-Type
header to application/json
.
set(header: String, value: String) -> Agent
Sets the HTTP header
to value
.
end(done: Response) -> Agent
Will start the request and call done
when it's complete.
- If the request was successful then
$0
will be anNSHTTPURLResponse
. - If the response had any data,
$1
will be anAnyObject
that you can type cast to either anArray
orDictionary
. - If there was an error then
$2
will be anNSErrror
that you can inspect for more information.
NSMutableURLRequest
You can always access the underlying NSMutableURLRequest
using req.request
.
Contributing
We're happy to receive any pull requests. Right now we're working hard on a number of features as seen below.
- Complete asynchronous tests
- Plugins
- Specialized agents (to handle default headers and such)
Any issue is appreciated.
License
MIT
*Note that all licence references and agreements mentioned in the agent README section above
are relevant to that project's source code only.