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

# Swift SDK Quickstart

> Install the Swift OMS Wallet SDK, create a client, and authenticate a wallet with email OTP.

The Swift SDK supports iOS 15+ and macOS 12+. `OMSClient` is the entry point for wallet auth, signing, signature verification, ID tokens, transaction helpers, and balance queries.

## Install

Add the package in Xcode with **File -> Add Package Dependencies** and enter the following git URL.

```swift theme={null}
https://github.com/0xsequence/swift-sdk.git
```

For CocoaPods, add the pod to your `Podfile`.

```ruby theme={null}
pod 'oms-client-swift-sdk', '0.1.0-alpha.1'
```

Import the SDK in the files that use it.

```swift theme={null}
import OMS_SDK
```

## Create The Client

Create one `OMSClient` when your app starts and keep it alive for the current app session.

```swift theme={null}
let oms = OMSClient(
    publishableKey: "YOUR_PROJECT_ACCESS_KEY",
    projectId: "YOUR_PROJECT_ID"
)
```

The client exposes:

| Property                | Use                                                                                                            |
| ----------------------- | -------------------------------------------------------------------------------------------------------------- |
| `oms.wallet`            | Authentication, session state, wallet selection, signing, signature verification, ID tokens, and transactions. |
| `oms.indexer`           | Token balance reads.                                                                                           |
| `oms.supportedNetworks` | Networks supported by this SDK build.                                                                          |

## Authenticate With Email

Email auth is a two-step OTP flow.

```swift theme={null}
try await oms.wallet.startEmailAuth(email: "user@example.com")

// Show your OTP input, then complete auth with the user-entered code.
let result = try await oms.wallet.completeEmailAuth(code: "123456")

if case let .walletSelected(walletAddress, _, _, _) = result {
    print("Wallet address:", walletAddress)
}
```

`completeEmailAuth` verifies the OTP, loads an existing wallet for the user, or creates one when needed. Wallet metadata and session state are persisted in the device keychain.

## Send A Transaction

After authentication, send a native token transaction with `oms.wallet.sendTransaction`. Values are raw base-unit integer strings.

On testnets, fee options are automatically sponsored, so Polygon Amoy is a good first network for testing.

```swift theme={null}
let tx = try await oms.wallet.sendTransaction(
    network: .polygonAmoy,
    to: "0xRecipient",
    value: "0"
)

print("Transaction:", tx.txnHash ?? tx.txnId)
```
