Network Core
Network core it is library which wraps NSURLRequest in an easy way.
Usage
- Make enum which inherited of 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
}
- Initialize
NetworkManager
let network = NetworkManager("https://jsonplaceholder.typicode.com")
- Make request
network.makeRequest(TestEndpoint.one) { (result: Result<String>) in
print(result)
}
License
Network Core is released under the MIT License.