CocoaPods trunk is moving to be read-only. Read more on the blog, there are 13 months to go.
| TestsTested | ✗ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | Mar 2017 |
| SwiftSwift Version | 3.0 |
| SPMSupports SPM | ✗ |
Maintained by Moch, Moch Xiao.
High-level network layer abstraction library written in Swift.
Alamofire directlySocket reconstruct all network interfaces, you are going to all the business code to replace the Alamofire to new Socket requests?Socket new interfaces to achieve, you are going to change the network interfaces which you already reconstructed back?Alamofire, all requests related parameters are located in the business code, and there are several different methods of calling the request, such as uploading and downloading and a normal request invoke methods on the inconsistency. Pack all related parameters into an object, you can use only one very method to achieve all different situations request call. Conforms to the Command Pattern rulesAlamofire andSocket both, only need to specify which way you want to use for request in command inside, and then expand the corresponding request mode implement (default only implements Alamofire)redes askRequestable struct LoginApi: Requestable {
var userName: String = ""
var passWord: String = ""
var url: URLConvertible {
return "https://host/to/path"
}
var method: HTTPMethod {
return .POST
}
var var bodies: HTTPBodies {
return [
"user": userName,
"pass": passWord
]
}
var headers: HTTPHeaders {
return [:]
}
}let loginRequest = LoginApi().action()
loginRequest.responseJSON {
debugPrint($0.result)
}
loginRequest.responseJSON(queue: DispatchQueue.global()) {
debugPrint($0.result)
}
.responseString {
switch $0.result {
case .success(let value):
debugPrint(value)
case .failure(let error):
debugPrint(error)
}
}
// .cancel()API.swift and change the setups to your server configuration.)Caching is handled on the system framework level by URLCache.
Redes is available under the MIT license. See the LICENSE file for more info.
Follow me on Twitter (@mochxiao)