Bridge alternatives and similar libraries
Based on the "Networking" category.
Alternatively, view Bridge alternatives based on common mentions on social networks and blogs.
-
RealReachability
We need to observe the REAL reachability of network. That's what RealReachability do. -
Networking
DISCONTINUED. 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. -
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. -
TWRDownloadManager
A modern download manager based on NSURLSession to deal with asynchronous downloading, management and persistence of multiple files. -
ws โ๏ธ
โ ๏ธ Deprecated - (in favour of Networking) :cloud: Elegantly connect to a JSON api. (Alamofire + Promises + JSON Parsing) -
MultiPeer
๐ฑ๐ฒ A wrapper for the MultipeerConnectivity framework for automatic offline data transmission between devices -
AFNetworking+RetryPolicy
Nice category that adds the ability to set the retry interval, retry count and progressiveness.
InfluxDB high-performance time series database

* 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 Bridge or a related project?
README
Bridge 

Simple Typed JSON HTTP Networking in Swift 4.0
GET
GET<Dict>("http://httpbin.org/ip").execute(success: { (response) in
let ip: Dict = response
})
let postID = "1"
GET<Dict>("http://jsonplaceholder.typicode.com/posts/#").execute(postID, success: { (response) in
let post: Dict = response
})
POST
let userComment = ["justin": "wow this is cool"]
let endpoint = POST<[String: AnyObject]>("https://api.bridge.com/comments")
endpoint.execute(params: userComment, success: { (commentResponse: [String: AnyObject]) -> () in
// Handle success
}, failure: { (error, data, request, response) in
// Handle failure
})
Interceptors
The power of Bridge is that it lets you create custom "Interceptors" to intercept process your requests before they are sent off to the internets, or to intercept and process your responses before they are returned to the caller's success block.
Attach custom headers based on the endpoint, write retry handling, write authentication handlers, use method tunneling. Interceptors allow Bridge to be extremely extensible to your project needs.
/**
* Conform to the `ResponseInterceptor` protocol for any Bridge that
* needs to work with or alter a request before it's sent over the wire
*/
public protocol ResponseInterceptor {
func process<ReturnType>(endpoint: Endpoint<ReturnType>, inout mutableRequest: NSMutableURLRequest)
}
/**
* Conform to the `ResponseInterceptor` protocol to work with data after
* the request is returned with a response.
*/
public protocol ResponseInterceptor {
func process<ReturnType>(endpoint: Endpoint<ReturnType>, response: NSHTTPURLResponse?, responseObject: ResponseObject) -> ProcessResults
}
Examples:
- Retry (Retries requests on response if not 2xx code)
- Model Cache (Caches objects on response)
- Method Tunneling (Changes the HTTP Verb)
Object Serialization
Bridge is implemented using generics which allow you to serialize to objects as long as your objects conform to the Parseable
protocol.
public protocol Parseable {
static func parseResponseObject(responseObject: AnyObject) throws -> AnyObject
}
It is left completely up to the developer on how you want to implement the Parseable
protocol. You can manually create and serialize your objects:
class User: AnyObject, Parseable {
var name: String?
var email: String?
var pictureURL: NSURL?
static func parseResponseObject(responseObject: AnyObject) throws -> AnyObject {
if let dict = responseObject as? Dictionary<String, AnyObject> {
let user = User()
user.name = dict["name"] as? String
user.email = dict["email"] as? String
user.pictureURL = NSURL(string: dict["avatar_url"] as! String)
return user
}
// If parsing encounters an error, throw enum that conforms to ErrorType.
throw BridgeErrorType.Parsing
}
}
Or you can also serialize them using whatever serialization libraries you like. This gist is an example of out out-of-box working solution for Mantle if you're already using Mantle models. No code change is required to your Mantle models.
Once models are setup, making calls are as simple as:
let endpoint = GET<GithubUser>("https://api.github.com/users/rawrjustin")
endpoint.execute(success: { (user: GithubUser) in
print(user)
})
let endpoint = GET<Array<GithubUser>>("https://api.github.com/users")
endpoint.execute(success: { (users: Array<GithubUser>) in
print(users)
}, failure: { (error: NSError?) in
print(error)
})
Advanced Features
Base URL
You can set the base url of your Bridge client
Bridge.sharedInstance.baseURL = "http://api.github.com"
GET<GithubUser>("/users/rawrjustin") // expands to http://api.github.com/users/rawrjustin
Cancellation by Tag
Easily cancel any requests tagged with an identifier.
Bridge.sharedInstance.cancelWithTag("DebouncedSearch")
Variable endpoints
Similar to how Rails maps :id for resources, #
is used as the character where a variable would be inserted into the path.
GET<Dict>("/photos/#")
will map to /photos/1
if you pass in 1
in the first variadic parameter when you call execute(). You can have multiple variables, they will be mapped in order respectively.
Additional HTTP headers
Endpoint Specific Interceptors
Requirements
- iOS 8.0+
- Swift 4.0
Installation
pod 'Bridge', '0.4.3'
github "rawrjustin/Bridge"
License
Bridge is licensed under MIT license.
Questions?
Open an issue
*Note that all licence references and agreements mentioned in the Bridge README section above
are relevant to that project's source code only.