Popularity
0.4
Stable
Activity
0.0
Stable
10
2
0
Code Quality Rank:
L5
Programming language: Swift
License: MIT License
Tags:
Network
Latest version: v2.0.0
ModestProposal alternatives and similar libraries
Based on the "Network" category.
Alternatively, view ModestProposal 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. -
Siesta
The civilized way to write REST API clients for iOS / macOS -
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. -
Taylor
A lightweight library for writing HTTP web servers with Swift -
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 -
Malibu
:surfer: Malibu is a networking library built on promises -
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
Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!
Promo
appwrite.io
* 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 ModestProposal or a related project?
README
ModestProposal 2.0
Makes building HTTP URLs and requests easy. Can be used with any networking library that accepts NSURLRequest as a parameter.
Features
- URL building helpers
- Request building helpers
- Basic authentication encoding
- Validation of HTTP response, status codes, and content types
- Enums for common HTTP status codes, content types, methods, and header fields
URL Building
let baseURL = NSURL(string: "http://test.com")!
// http://test.com/login
let loginURL = baseURL.relativeToPath("/login")
// http://test.com/data?id=100&page=3
let dataURL = baseURL.relativeToPath("/data", parameters: ["id": "100", "page": "3"])
Request building
let baseRequest = NSMutableURLRequest(URL: baseURL)
// Set custom header for all requests
baseRequest["Custom-Header"] = "Custom value"
// URL will have the parameters added to the end of it
let readRequest = baseRequest.GET(path: "/object", parameters: ["id": "100", "page": "3"])
readRequest[.Accept] = "application/json"
// HTTPBody will be set to parameters, content type will be "application/x-www-form-urlencoded"
// and length will be set to match the size of the data generated by parameters
let createRequest = baseRequest.POST(path: "/create", parameters: ["id": "100", "page": "3"])
// HTTPBody will be set to JSON data, content type will be "application/json"
// and length will be set appropriately
let updateRequest = baseRequest.PUT(path: "/update", JSONObject: ["test": 100])
// HTTPBody will be set to data, content type will be "application/octet-stream"
// and length will be set to the length of the supplied data
let data = NSData(contentsOfFile: "file")
let dataRequest = baseRequest.POST(path: "/data", body: data)
Basic authentication
let baseRequest = NSURLRequest(URL: baseURL)
let loginRequest = baseRequest.POST(path: "/login")
loginRequest.basicAuthorization(username: "test", password: "test")
Response validation
let response: NSURLResponse = ...
do {
try response.validateIsSuccessfulJSON()
// OR
try response.validateIsSuccessfulImage()
// OR
try response.validateIsHTTP(statusCode: .OK, contentType: .ApplicationJSON)
// OR
try response.validateIsHTTP(statusCode: 200, contentType: "application/json")
// OR
try validate(when: respone.isHTTP, otherwise: HTTPError.UnexpectedResponse(response))
try validate(when: respone.HTTP.statusCode == 200, otherwise: HTTPError.UnexpectedStatusCode(respone.HTTP.statusCode))
try validate(when: respone.HTTP.MIMEType == "application/json", otherwise: HTTPError.UnexpectedContentType(respone.HTTP.MIMEType))
}
catch {
// Handle error
}