# iOS (Swift)

## iOS (Swift)
**Requirements:** iOS 13.0+, Xcode 15.3+.
**Install** via Swift Package Manager — File → Add Package Dependencies, repo URL: `https://github.com/socure-inc/socure-sigmadevice-sdk-ios`.
**Initialize**:

```swift
import DeviceRisk

let options = SigmaDeviceOptions()
options.omitLocationData = false

SigmaDevice.initializeSDK("YOUR_SDK_KEY", options: options) { result, error in
    if let error = error { print("SDK init error: \(error)"); return }
    // SDK initialized successfully
}
```
**Generate a token and run SNA** — do both before your Prefill request:

```swift
Task {
    do {
        let diSessionToken = try await SigmaDevice.getSessionToken()
        // performSilentNetworkAuth is the call that actually runs SNA. Mobile
        // number in E.164 format; await it so the result is ready for decisioning.
        try? await SigmaDevice.performSilentNetworkAuth(mobileNumber: "+15551234567")
        // ...include diSessionToken on your Prefill request
    } catch {
        // Proceed without token — the user falls back to OTP verification
    }
}
```

Version: v3

## Description:

  - `iOS (Swift)` ()
    Requirements: iOS 13.0+, Xcode 15.3+. Install via Swift Package Manager — File → Add Package Dependencies, repo URL: https://github.com/socure-inc/socure-sigmadevice-sdk-ios. Initialize: import DeviceRisk

let options = SigmaDeviceOptions()
options.omitLocationData = false

SigmaDevice.initializeSDK("YOUR_SDK_KEY", options: options) { result, error in
    if let error = error { print("SDK init error: \(error)"); return }
    // SDK initialized successfully
}
import DeviceRisk

let options = SigmaDeviceOptions()
options.omitLocationData = false

SigmaDevice.initializeSDK("YOUR_SDK_KEY", options: options) { result, error in
    if let error = error { print("SDK init error: \(error)"); return }
    // SDK initialized successfully
} Generate a token and run SNA — do both before your Prefill request: Task {
    do {
        let diSessionToken = try await SigmaDevice.getSessionToken()
        // performSilentNetworkAuth is the call that actually runs SNA. Mobile
        // number in E.164 format; await it so the result is ready for decisioning.
        try? await SigmaDevice.performSilentNetworkAuth(mobileNumber: "+15551234567")
        // ...include diSessionToken on your Prefill request
    } catch {
        // Proceed without token — the user falls back to OTP verification
    }
}
Task {
    do {
        let diSessionToken = try await SigmaDevice.getSessionToken()
        // performSilentNetworkAuth is the call that actually runs SNA. Mobile
        // number in E.164 format; await it so the result is ready for decisioning.
        try? await SigmaDevice.performSilentNetworkAuth(mobileNumber: "+15551234567")
        // ...include diSessionToken on your Prefill request
    } catch {
        // Proceed without token — the user falls back to OTP verification
    }
}

