iOS SDK - Getting Started

Quick Start Guide

This guide will lead you through the first steps of integrating the Anyline Tire Tread SDK into your iOS app.

Add Anyline Tire Tread SDK as dependency

The Anyline Tire Tread SDK for iOS is available via CocoaPods and Swift Package Manager.


CocoaPods

Add the following line to your Podfile (replace the path with the actual path to your local .framework or .xcframework file):

pod 'AnylineTireTreadSdk', :path => '~/path/to/AnylineTireTreadSdk'

Run pod install in the terminal in the same directory as your Podfile.

Swift Package Manager

In Xcode, go to File → Swift Packages → Add Package Dependency and enter the local path to the framework repository.


After cloning the adding the dependency, import the framework into your native iOS application.

import AnylineTireTreadSdk

The Anyline Tire Tread SDK follows the Semantic Versioning.

Integrate the Anyline License Key

A License Key string will be required in order to run the Anyline Tire Tread SDK on your app.

Please reach out to [email protected] to obtain your license key.

Store the License Key

You can integrate your license key however best fits your application’s workflow.

For instance, a recommended method to store the license key is in the system Keychain.

Initialize the iOS Tire Tread SDK with the License Key

Initialize the Anyline Tire Tread SDK – and handle any exceptions thrown – before doing anything related to the SDK.

Here is an example on how to do it:

// This must be called before doing anything else with the
// AnylineTireTreadSdk. It only needs to be called once during
// your application life-cycle.
func tryInitializeSdk(context: UIViewController) {
    do {
        let licenseKey = "<your-license-key>"

        try AnylineTireTreadSdk.companion.doInit(licenseKey: licenseKey, context: context)

        // Continue setup after successful initialization
    } catch {
        // Handle initialization error
    }
}
In the code above, replace <your-license-key> with your actual license key.

This function attempts to initialize the AnylineTireTreadSdk with the provided license key. If the SDK fails to initialize, you should handle this error appropriately.

Check Camera Permissions

Before starting the scan process, it is crucial to check and request camera permissions, as they are mandatory for the SDK to function correctly. Here is an example on how to do it:

func requestPermissionsAndProceed() {
    let cameraAuthorizationStatus = AVCaptureDevice.authorizationStatus(for: .video)

    switch cameraAuthorizationStatus {
    case .authorized:
        // Continue with setup
    case .notDetermined:
        AVCaptureDevice.requestAccess(for: .video) { granted in
            DispatchQueue.main.async {
                if granted {
                    // Continue with setup
                } else {
                    // Handle denied access
                }
            }
        }
    default:
        // Handle other cases
    }
}

In the next section, you will learn how to integrate the TireTreadScanView to start scanning and measuring tires with your application.