> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truv.com/llms.txt
> Use this file to discover all available pages before exploring further.

# iOS SDK

> Truv Bridge SDK for iOS (Swift)

**Package:** `TruvSDK` | [Swift Package](https://github.com/truvhq/ios-sdk) | [CocoaPods](https://cocoapods.org/pods/TruvSDK) | [Demo app](https://github.com/truvhq/demo-ios)

## Install

### Swift Package Manager

1. In Xcode, go to **File > Add Package Dependencies**
2. Enter the package URL:
   ```
   https://github.com/truvhq/ios-sdk.git
   ```
3. Select the version and add `TruvSDK` to your target

### CocoaPods

<Warning>
  [CocoaPods trunk becomes read-only on December 2, 2026](https://blog.cocoapods.org/CocoaPods-Specs-Repo/). No new library versions can be published after that date. Truv plans to stop publishing CocoaPods updates in December 2026. Swift Package Manager is recommended for new projects.
</Warning>

Add to your `Podfile`:

```ruby theme={null}
pod 'TruvSDK'
```

Then run:

```bash theme={null}
pod install
```

***

## Embedded Orders

Use `TruvOrderController` to present an Order, a multi-connection verification workflow that supports multiple data sources and product types.

```swift theme={null}
import TruvSDK

class ViewController: UIViewController {

    func openOrder(token: String) {
        let order = TruvOrderController(token: token, delegate: self)
        order.modalPresentationStyle = .fullScreen
        present(order, animated: true)
    }
}

extension ViewController: TruvOrderDelegate {

    func onOrderEvent(_ event: TruvOrderEvent) {
        switch event {
        case .load:
            // Order page finished loading
            break

        case .close:
            // User closed the Order
            break

        case .success:
            // A task within the Order completed successfully.
            // The Order is still open at this point — it may show
            // a success screen or a self-certification screen
            // depending on the configuration.
            break

        case .completed:
            // The entire Order is complete (all tasks finished)
            break
        }
    }

    func onBridgeEvent(_ event: TruvEventPayload) {
        // Fired when the user interacts with the Bridge for a
        // sub-order (task) within the Order.
        // Equivalent to TruvDelegate.onEvent(.onEvent(payload)).
    }
}
```

***

## Bridge Widget

Use `TruvBridgeController` for single-connection flows like Direct Deposit Switch and Paycheck Linked Lending.

```swift theme={null}
import TruvSDK

class ViewController: UIViewController {

    func openBridge(token: String) {
        let bridge = TruvBridgeController(token: token, delegate: self)
        bridge.modalPresentationStyle = .fullScreen
        present(bridge, animated: true)
    }
}

extension ViewController: TruvDelegate {

    func onEvent(_ event: TruvEvent) {
        switch event {
        case .onLoad:
            // Bridge finished loading
            break

        case .onClose:
            // User closed the Bridge
            break

        case .onSuccess(let payload):
            // Called when the Bridge closes after a successful task.
            // payload?.publicToken — use this to retrieve data server-side.
            // payload?.metadata.taskId — the task identifier.
            break

        case .onEvent(let payload):
            // Lifecycle event — see Bridge Events for all types.
            break
        }
    }
}
```

See [Bridge Events](/developers/sdks/bridge-events) for all event types, payloads, and error codes.

***

## Sample app

<Card title="iOS Demo (Swift)" icon="apple" href="https://github.com/truvhq/demo-ios">
  Swift demo using `TruvSDK`
</Card>

<Steps>
  <Step title="Clone the repo">
    Clone the demo app from GitHub and install dependencies.
  </Step>

  <Step title="Add your API keys">
    Copy your **Client ID** and **Access Secret** from the [Dashboard](https://dashboard.truv.com) into the app's configuration file.
  </Step>

  <Step title="Run in sandbox mode">
    Use [sandbox test credentials](/developers/testing/test-credentials) to simulate a full verification flow. Use the demo app as a reference to understand how the SDK works.
  </Step>

  <Step title="Integrate the SDK into your app">
    Follow the implementation guide above to add Truv Bridge to your own application.
  </Step>

  <Step title="Go live">
    Swap in production credentials in your app when ready.
  </Step>
</Steps>
