CocoaPods trunk is moving to be read-only. Read more on the blog, there are 9 months to go.

WebService 0.4.2

WebService 0.4.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Mar 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Prateek kansara.



  • By
  • Prateek Kansara

WebService

Requirements

  • iOS 8.0+
  • Xcode 7.3.1+

Installation

WebService is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "WebService"

Usage

// 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)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Prateek Kansara, [email protected]

License

WebService is available under the MIT license. See the LICENSE file for more info.