/Swift-SDK

The Knurld Swift SDK makes it easy to incorporate voice verification in your iOS applications.

Primary LanguageSwiftBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Knurld Swift SDK

The Knurld Swift SDK wraps the Knurld web API to simplify integration of Knurld's voice verification services with your iOS applications.

To learn more about Knurld, please visit us at https://www.knurld.io.

Communication

If you encounter any issues using this SDK, please reach out to our development team at developer@knurld.com.

Requirements

  • iOS 8.0+

Installation

Carthage

Add the Knurld Swift SDK to your Cartfile:

github "knurld/Swift-SDK"

Make sure to link both the KnurldSDK and Freddy frameworks; the Knurld SDK depends on Freddy for working with JSON.

CocoaPods

Add the Knurld Swift SDK to your Podfile:

pod 'KnurldSDK', :git => 'https://github.com/knurld/Swift-SDK.git'

Usage

Create an instance of KnurldAPI and execute all of your requests against its members. For example, to check the status of the Knurld services:

  1. Create an instance of KnurldAPI:

    let api = KnurldAPI()
  2. Get an access token using your API credentials:

    let oAuthCredentials = OAuthCredentials(clientID: "your client ID",
                                            clientSecret: "your client secret")
    var knurldCredentials: KnurldCredentials?
    api.authorization.authorize(credentials: oAuthCredentials,
                                developerID: "your developer ID",
                                successHandler: { knurldCredentials = $0 },
                                failureHandler: { print("ERROR: \($0)") })
  3. Once knurldCredentials is non-nil, ask the API for its status:

    var status: ServiceStatus?
    api.status.get(credentials: knurldCredentials,
                   successHandler: { status = $0 },
                   failureHandler: { print("ERROR: \($0)") })
  4. Once status is non-nil, it will contain the Knurld service status.

    if let status = status {
        print("Knurld API version is \(status.version)")
    }

Documentation

Full documentation of the SDK is at https://knurld.github.io/Swift-SDK/. The SDK documentation assumes familiarity with the Knurld web API.

For details on the Knurld web API, especially to learn its call flow and the significance of each call's data types, please see the Knurld developer guide.

Development

To develop this SDK:

  1. Install Carthage on your system, if it isn't already installed
  2. Clone the SDK repository and run ./bin/setup from the repository root
  3. Open KnurldSDK.xcworkspace in Xcode and develop
  4. To test, populate your Knurld API credentials in KnurldSDKTests/TestCredentials.swift and run Product -> Test in Xcode