Websync 0.1.3

Websync 0.1.3

Maintained by CHOLA.



Websync 0.1.3

Websync

CI Status Version License Platform

Example

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

Requirements

Installation

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

pod 'Websync'

How to use

STEP 1:

Your API Url

Websync.websynch_baseUrl = "https://your_api_url/"

Create structure for post data

struct pLogin: Codable {
var userName: String
var password: String
}

Create structure for response data

struct rLogin: Codable {
var success: Bool
var access_token: String
}

STEP 2:

Excecute simple API call

import Websync

let user = pLogin(userName: "[email protected]", password: "raj123456")

Websync().post(postBody: user, methodName: "users", expected: rLogin.self) { response, error in

if response != nil {

let userResponse = response as! rLogin
print(userResponse.success)

} else {

// Error message here..

}

}

Excecute API call with cache and header

Websync().post(postBody: user, methodName: "users", expected: rLogin.self, header: ["auth":"12121"], cache: true) { response, error in

if response != nil {

let userResponse = response as! rLogin
print(userResponse.success)

} else {

// Error message here..

}

}

Author

chola, [email protected]

License

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