> For the complete documentation index, see [llms.txt](https://docs.movesdk.com/move-platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/getting-started/ios-1/quick-start.md).

# Quick Start

{% hint style="info" %}
Check our public [sample application](https://bitbucket.org/dolphin-technologies/move-ios-sample/src/master/) for an actual implementation of the snippets below and how they can be utilized.&#x20;
{% endhint %}

## Overall Code

A quick start snippet will look something like this in your app's [`willFinishLaunchWithOptions`](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623032-application):

```swift
import MoveSDK

func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
     
    MoveSDK.shared.setSDKStateListener { state in
        switch state {
        case .uninitialized:
            /* SDK uninitialized*/
            break
        case .ready:
            /* SDK initialized and ready to start the service*/
            MoveSDK.shared.startAutomaticDetection()
        case .running:
            /* SDK Started Detection*/
            break
        case let .error(error):
            switch error {
            /* Hanlde SDK State Errors*/
            default: break
            }
        }
    }
 
    let sdkConfig = MoveConfig(timelineDetectionService: 
                    [.walking, .driving, .bicycle, .places, .publicTransport], 
                    drivingServices: [.dfd, .behaviour], 
                    otherServices: [.poi])
 
    MoveSDK.shared.initialize(auth: auth, config: sdkConfig, launchOptions: launchOptions) { initError in
        if let error = initError {
            switch error {
            /* Hanlde SDK Initialize Error*/
            default: break
            }
        }
    }
}
```

{% hint style="warning" %}
This snippet assumes that the required configurations and permissions are already setup to work. Check [permissions handling](/move-platform/move-sdk-1.x/sdk/appendix/ios/permission-handling.md#required-permissions) section for more details.
{% endhint %}

## Breakdown

Let us break down the overall code block into the following:&#x20;

### SDK Authorization

The [MoveAuth](/move-platform/move-sdk-1.x/sdk/models/moveauth.md) will look something like this:

```swift
let auth = MoveAuth(userToken: "",refreshToken: "" contractID: "", productID: "" )
```

If the provided [MoveAuth](/move-platform/move-sdk-1.x/sdk/models/moveauth.md) was invalid, the SDK will not initialize and complete with [MoveConfigurationError](/move-platform/move-sdk-1.x/sdk/models/moveconfigurationerror.md)`.authInvalid`. Check [Initialization](/move-platform/move-sdk-1.x/sdk/api-interface/ios/intialization.md) for more details about possible outcomes.

{% hint style="warning" %}

### Authentication Expiry

The host app is expected to monitor [MoveAuthState](/move-platform/move-sdk-1.x/sdk/models/moveauthstate.md) updates via`authStateChangeListener`([iOS](/move-platform/move-sdk-1.x/sdk/api-interface/ios/services.md#set-sdk-auth-state-listener)) API and handle those changes accordingly.

Check [Authentication updates and expiry](/move-platform/move-sdk-1.x/sdk/models/moveauthstate.md#authentication-updates-and-expiry) for more details about authentication expiry and renewal.
{% endhint %}

### SDK Configuration

[MoveConfig](/move-platform/move-sdk-1.x/sdk/models/moveauth.md) allows host apps to configure which of the licensed Move services should be enabled. It could be based on each user preference or set from a remote server.

{% hint style="danger" %}
**iOS System Permissions**

Based on the passed [MoveConfigs](/move-platform/move-sdk-1.x/sdk/models/moveauth.md) on[`initialization`](/move-platform/move-sdk-1.x/sdk/api-interface/ios/intialization.md) , the SDK determines the required permissions to activate the requested services.\
\
The host app **must** verify that all the permissions required for the passed configs are granted.\
\
In case the required permissions were missing when calling SDK [initialization](/move-platform/move-sdk-1.x/sdk/api-interface/ios/intialization.md) API, the [MoveSDKState](/move-platform/move-sdk-1.x/sdk/models/movedevicestatus.md) will transit to `permissionMissing`error [MoveSDKState](/move-platform/move-sdk-1.x/sdk/models/movedevicestatus.md) other than `ready`[MoveSDKState](/move-platform/move-sdk-1.x/sdk/models/movedevicestatus.md).

Check [permission handling](/move-platform/move-sdk-1.x/sdk/appendix/ios/permission-handling.md) for details about permissions required for each service.
{% endhint %}

The [MoveConfig](/move-platform/move-sdk-1.x/sdk/models/moveauth.md) will look something like this:

```swift
let sdkConfig = MoveConfig(
                timelineDetectionService: [.walking, .driving, .bicycle, .places, 
                .publicTransport],
                drivingServices: [.dfd, .behaviour], 
                otherServices: [.poi])
```

### SDK State

The host app is expected to set its [`SDKStateListener`](/move-platform/move-sdk-1.x/sdk/api-interface/ios/services.md#set-sdk-state-listener) **before** initializing the SDK to intercept the [MoveSDKState](/move-platform/move-sdk-1.x/sdk/models/movestate.md) changes caused by calling the [`initialize`](/move-platform/move-sdk-1.x/sdk/api-interface/ios/intialization.md) API.

The provided block could then start the SDK when [MoveSDKState](/move-platform/move-sdk-1.x/sdk/models/movestate.md) is `ready` or handle errors if occurred. The provided block could look something like this:&#x20;

{% hint style="info" %}
Only calling [`startAutomaticDetection`](/move-platform/move-sdk-1.x/sdk/api-interface/ios/services.md#start-automatic-detection)API will transit [MoveSDKState](/move-platform/move-sdk-1.x/sdk/models/movestate.md) is `ready state.`
{% endhint %}

```swift
MoveSDK.shared.setSDKStateListener { state in
    switch state {
    case .uninitialized:
        /* SDK uninitialized*/
        break
    case .ready:
        /* SDK initialised and ready to start the service*/
        MoveSDK.shared.startAutomaticDetection()
    case .running:
        /* SDK Started Detection*/
        break
    case let .error(error):
        switch error {
        /* Hanlde SDK State Errors*/
        default: break
        }
    }
}
```

### SDK Initialization&#x20;

{% hint style="warning" %}
The[`initialization`](/move-platform/move-sdk-1.x/sdk/api-interface/ios/intialization.md)API must be executed before[`didFinishLaunchingWithOptions`](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622921-application)returns. We recommend calling it in[`willFinishLaunchingWithOptions`](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623032-application) .\
\
Exceptions might apply, where the SDK is not initialized on app launch.  First initialization is a good example, where the app would only initialize the SDK after onboarding the user and requesting permissions. \
\
Check[ Initialization Timing](/move-platform/move-sdk-1.x/sdk/api-interface/ios/intialization.md#timing) for more details about the importance of adequately initializing the SDK.
{% endhint %}

```swift
MoveSDK.shared.initialize(auth: auth, config: sdkConfig, launchOptions: launchOptions) { initError in
    if let error = initError {
        switch error {
        /* Hanlde SDK Initialization MoveConfigurationError*/
        default: break
        }
    }
}
```
