SolarNetwork alternatives and similar libraries
Based on the "Network" category.
Alternatively, view SolarNetwork 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. -
Swifton
A Ruby on Rails inspired Web Framework for Swift that runs on Linux and OS X -
CocoaMQTT
MQTT 5.0 client library for iOS and macOS written in Swift -
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 -
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 SolarNetwork or a related project?
Popular Comparisons
README
[SLNetwork](SLNetwork.png)
Elegant network abstraction layer in Swift.
- [δΈζ](ChineseREADME.md)
- Design
- Features
- Requirements
- Communication
- Installation
- Usage
- Base Usage - Target - Request - Download - Upload - Decode
- [Target](Documentation/Target.md) - Configuration of a Host.
- [Request](Documentation/Request.md) - Configuration of a DataRequest.
- [Download](Documentation/Download.md) - Configuration of a DownloadRequest or ResumeDownloadRequest.
- [Upload](Documentation/Upload.md) - Configuration of a UploadRequest(Data - File - InputStream - FormData).
- [Progress](Documentation/Progress.md) - Progress
- [Response](Documentation/Response.md) - Decode - Error
- [Plugin](Documentation/Plugin.md) - WillSend - DidReceive
- License
- [UpdateLog](Documentation/UpdateLog.md)
Design
Alamofire and Moya are elegant Swift network frames. They each have their own advantages. When I use them, I always want to combine the advantages of both, make them easy to use and retain their original features. So I wrote the SolarNetwork.
- SLNetwork corresponds to a SessionManager.
- SLTarget corresponds to a Host, or a set of requests for the same configuration.
- SLRequest, SLDownloadRequest, SLUploadRequest corresponds to Request of Data, Download, Upload.
- SLProgress return progress when download or upload.
- SLResponse response of a request which you can decode to JsonObject or Model.
- SLPlugin you can modify SLRequest in
willSend
and modify SLResponse indidReceive
. - SLReflection reflex properties of SubSLRequest to Alamofire.Parameters.
So a complete request process is:
SLNetwork(SLTarget).request(SLRequest).willSend(SLRequest)
.progressClosure(SLProgress)
.reponseData(OriginalResponse)
.didReceive(SLResponse).decodeTo(Dictionary)
.completionClosure(SLResponse)
.decodeTo(Model: Decodable).dealWithError
In most cases, what you need to concerned about is:
SLNetwork(SLTarget).request(SLRequest)
.progressClosure(SLProgress)
.completionClosure(SLResponse)
Features
- [x] URL / JSON / plist Parameter Encoding
- [x] Upload File / Data / Stream / MultipartFormData
- [x] Download File using Request or Resume Data
- [x] Authentication with URLCredential
- [x] Upload and Download Progress Closures with Progress
- [x] Dynamically Adapt and Retry Requests
- [x] TLS Certificate and Public Key Pinning
- [x] Network Reachability
- [x] Pre-populate the DNS cache
- [x] Complete Logger
Requirements
- iOS 8.0+
- Xcode 9+
- Swift 4+
Communication
- If you'd like to ask a general question, use Stack Overflow.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
CocoaPods 1.1+ is required.
To integrate SolarNetwork into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target '<Your Target Name>' do
pod 'SolarNetwork'
end
Then, run the following command:
$ pod install
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate Alamofire into your Xcode project using Carthage, specify it in your Cartfile
:
github "ThreeGayHub/SolarNetwork"
Run carthage update
If this is your first time using Carthage in the project, you'll need to go through some additional steps as explained over at Carthage.
Usage
Base Usage
Target
import SolarNetwork
struct HTTPBinTarget: SLTarget {
var baseURLString: String { return "https://httpbin.org" }
}
let HTTPBinNetwork = SLNetwork(HTTPBinTarget())
Request
import SolarNetwork
//Mark: - GET
class HTTPBinGETRequest: SLRequest {
override func loadRequest() {
super.loadRequest()
self.path = "/get"
}
}
HTTPBinNetwork.request(HTTPBinGETRequest()) { (response) in
if let dictionary = response.dataDictionary {
}
else if let error = response.error {
//show error
}
}
//Mark: - POST
class HTTPBinPOSTRequest: SLRequest {
override func loadRequest() {
super.loadRequest()
self.method = .post
self.path = "/post"
}
/**
properties will encode to parameters by Reflection
["userName": "myUserName",
"password": "myPassword",
"name" : "youName"]
*/
let userName = "myUserName"
let password = "myPassword"
var name: String?
}
let postReq = HTTPBinPOSTRequest()
postReq.name = "yourName"
HTTPBinNetwork.request(postReq) { (response) in
if let dictionary = response.dataDictionary {
}
else if let error = response.error {
//show error
}
}
Download
import SolarNetwork
class HTTPBinDownLoadRequest: SLDownloadRequest {
override func loadRequest() {
super.loadRequest()
self.path = "/image/png"
self.isResume = true //control the download request is resume or not, default is false
}
}
HTTPBinNetwork.download(HTTPBinDownLoadRequest(), progressClosure: { (progress) in
}) { (resposne) in
}
Upload
import SolarNetwork
class HTTPBinUploadRequest: SLUploadRequest {
override func loadRequest() {
super.loadRequest()
self.path = "/post"
}
}
let uploadRequest = HTTPBinUploadRequest()
uploadRequest.data = data //data to upload
HTTPBinNetwork.upload(uploadRequest, progressClosure: { (progress) in
}) { (response) in
}
Decode
In Swift 4, you can use Codable.
import SolarNetwork
struct User: Decodable { //Swift 4 Codable
var id: Int
var name: String
var token: String
}
HTTPBinNetwork.request(UserRequest()) { (response) in
if let user = response.decode(to: User.self) {
}
else if let error = response.error {
//show error
}
}
License
Alamofire is released under the MIT license. See LICENSE for details.
*Note that all licence references and agreements mentioned in the SolarNetwork README section above
are relevant to that project's source code only.