GMNetworking
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Require Alamofire and EVReflection
Installation
GMNetworking is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "GMNetworking"
Usage
Initialization
private func setUpNetWorking() {
GMNetworking.netErrorMsg = "网络错误"
GMNetworking.apiHost = APIHost
GMNetworking.urlCommonParameters = UrlCommonParams()
}
Response Handling
GMNetworking.request(.get, api, nil) { (response: GMResponse<JsonType>?, error) in
if error != nil || (response?.error != nil && response?.error != .Success) {
completion?(data: nil, error: true, message: response!.message)
return
}
completion?(data: response!.data, error: false, message: response!.message)
}
For more cases or workground please see Example or Unit Test.
Author
wangyang, wangyang@wanmeizhensuo.com
License
GMNetworking is available under the MIT license. See the LICENSE file for more info.