> For the complete documentation index, see [llms.txt](https://hinkal-team.gitbook.io/hinkal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hinkal-team.gitbook.io/hinkal/hinkal-mobile-sdk/ios/ios-sdk.md).

# IOS SDK

Native Swift SDK for privacy-preserving transactions on iOS.

The Hinkal iOS SDK is the Hinkal Go core compiled to a native `Hinkal.xcframework` with [gomobile](https://pkg.go.dev/golang.org/x/mobile/cmd/gomobile). It exposes Swift APIs for shielded deposits, withdrawals, transfers, swaps, and bridging. Signing stays in your app - you implement a host wallet, and the private key never leaves the device wallet.

### Features

* Native Swift framework - no JavaScript bridge, no WebView
* Deposit, withdraw, transfer, swap, and bridge from the shielded balance
* Wallet-agnostic - implement `MobileHostWalletProtocol` once for any EVM signer (or `MobileHostSolanaSignerProtocol` / `MobileHostTronSignerProtocol`)
* JSON-string boundary, so one call can batch multiple tokens, amounts, and recipients
* Identical core to the Android SDK - same proofs, same network protocol

### Installation

Add the SDK with Swift Package Manager - point Xcode at `https://github.com/Hinkal-Protocol/hinkal-sdk`. SPM downloads and checksum-verifies the prebuilt `Hinkal.xcframework` binary automatically. See the installation guide for full details.

```swift
import Hinkal
```

### Quick Example

```swift
import Hinkal

guard let client = MobileNewClient(), let hinkal = client.hinkal() else { return }
let address = try call { client.connect(WalletHost(wallet: yourWallet), error: &$0) }

let wei = try call { MobileAmountToWei(chainId, tokenAddress, "1.0", &$0) }
let result = try call {
    hinkal.deposit(chainId, tokenAddrsJSON: "[\"\(tokenAddress)\"]",
                   amountsWeiJSON: "[\"\(wei)\"]", preEstimateGas: true, returnTxData: false, error: &$0)
}
print("Deposit tx:", result)
```

Throwing calls take an `NSError` out-parameter; the `call` helper (see Getting Started) rethrows it as a Swift `try`.

### Core Operations

<table data-search="false"><thead><tr><th>Method</th><th>Purpose</th></tr></thead><tbody><tr><td><code>deposit</code></td><td>Public to private</td></tr><tr><td><code>withdraw</code></td><td>Private to public</td></tr><tr><td><code>transfer</code></td><td>Private to private</td></tr><tr><td><code>swap</code></td><td>Private swap</td></tr><tr><td><code>bridgePrivateToPrivate</code></td><td>Private to private across chains</td></tr><tr><td><code>getTotalBalance</code></td><td>Shielded balance</td></tr><tr><td><code>getRecipientInfo</code></td><td>Private address for the identity</td></tr></tbody></table>

### Documentation

#### Getting Started

* [Installation](/hinkal/hinkal-mobile-sdk/ios/installation.md)
* [Getting Started](/hinkal/hinkal-mobile-sdk/ios/getting-started.md)

#### Guides

* [Deposits](/hinkal/hinkal-mobile-sdk/ios/guides/deposits.md)
* [Withdrawals](/hinkal/hinkal-mobile-sdk/ios/guides/withdrawals.md)
* [Transfers](/hinkal/hinkal-mobile-sdk/ios/guides/transfers.md)
* [Swaps](/hinkal/hinkal-mobile-sdk/ios/guides/swaps.md)
* [Balances](/hinkal/hinkal-mobile-sdk/ios/guides/balances.md)
* [Multi-Chain](/hinkal/hinkal-mobile-sdk/ios/guides/multi-chain.md)
* [Wallet Integration](/hinkal/hinkal-mobile-sdk/ios/guides/wallet-integration.md)
* [Error Handling](/hinkal/hinkal-mobile-sdk/ios/guides/error-handling.md)

#### Advanced

* [Performance](/hinkal/hinkal-mobile-sdk/ios/advanced/performance.md)
* [Error Handling Patterns](/hinkal/hinkal-mobile-sdk/ios/advanced/error-handling-patterns.md)

#### Reference

* [API Reference](/hinkal/hinkal-mobile-sdk/ios/api-reference.md)

### Requirements

* iOS 16.0+
* Swift 5.7+
* Xcode 15+ (Swift Package Manager is bundled)

### Related

* Android SDK - the same SDK for Android
* Quickstart - fast integration
