Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/essentiaone/essentia-network-core-ios

Wrapper of NSURLRequest
https://github.com/essentiaone/essentia-network-core-ios

networkmanager nsurlrequest swift

Last synced: about 2 months ago
JSON representation

Wrapper of NSURLRequest

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.com/essentiaone/essentia-network-core-ios.svg?branch=develop)](https://travis-ci.com/essentiaone/essentia-network-core-ios)
[![Badge w/ Version](https://cocoapod-badges.herokuapp.com/v/essentia-network-core-ios/badge.png)](https://cocoadocs.org/docsets/essentia-network-core-ios)
[![Badge w/ Platform](https://cocoapod-badges.herokuapp.com/p/essentia-network-core-ios/badge.svg)](https://cocoadocs.org/docsets/essentia-network-core-ios)
[![Badge w/ Licence](https://cocoapod-badges.herokuapp.com/l/essentia-network-core-ios/badge.svg)](https://cocoadocs.org/docsets/essentia-network-core-ios)

# Network Core
Network core it is library which wraps NSURLRequest in an easy way.
## Usage
1. Make enum which inherited of RequestProtocol
```Swift
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
}
```
2. Initialize `NetworkManager`
```Swift
let network = NetworkManager("https://jsonplaceholder.typicode.com")
```
3. Make request
```Swift
network.makeRequest(TestEndpoint.one) { (result: Result) in
print(result)
}
```
## License
Network Core is released under the [MIT License](https://github.com/essentiaone/essentia-network-core-ios/blob/develop/LICENSE).