CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.
TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Mar 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Prateek kansara.
WebService is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "WebService"
// Import webService class
import WebService
// Basic Header Dictionary
var httpHeaderRequestDict : NSMutableDictionary!{
get{
let mutableDict : NSMutableDictionary = NSMutableDictionary()
mutableDict.setValue("AUTHKEY", forKey: "Authorization")
mutableDict.setValue("application/json", forKey: "Content-Type")
return mutableDict
}
}
// Create webService object
var webServiceObject : WebService = WebService()
// Set header value for all request
webServiceObject.setDefaultHeaders(httpHeaderRequestDict)
* use webServiceObject.httpHeaders to set different headers required for this call.
webServiceObject.sendRequest(URLString, parameters: params, requestType: .GET, success: {
(response : NSHTTPURLResponse?, dictionary : AnyObject) in
// Handle data when request Success
}, failed: {
(response : NSHTTPURLResponse?, ResponseDict : AnyObject?) in
// Handle data when request fails
}, encoded: false)
To run the example project, clone the repo, and run pod install
from the Example directory first.
Prateek Kansara, [email protected]
WebService is available under the MIT license. See the LICENSE file for more info.