essentia-network-core-ios 0.2.5

essentia-network-core-ios 0.2.5

Pavlo Boiko 维护。



  • impl

Build Status Badge w/ Version Badge w/ Platform Badge w/ Licence

网络核心

网络核心是一个将 NSURLRequest 封装在简单方式中的库。

使用方法

  1. 创建一个继承自 RequestProtocol 的枚举
enum TestEndpoint: RequestProtocol {
var path: String {
    return "/todos/1"
}
var extraHeaders: [String : String]? {
    return nil
}
var parameters: [String : Any]? {
    return nil
}
var requestType: RequestType {
    return .get
}
var contentType: RequestContentType {
    return .json    
}
case one
}
  1. 初始化 NetworkManager
let network = NetworkManager("https://jsonplaceholder.typicode.com")
  1. 发起请求
network.makeRequest(TestEndpoint.one) { (result: Result<String>) in
    print(result)
}

许可证

Network Core 是在 MIT 许可证下发布的。