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

# iOS

> OTA SDK for Swift and Objective-C iOS apps

<Card title="phrase/ios-sdk" icon="github" horizontal href="https://github.com/phrase/ios-sdk" />

<Card title="phrase/ios-demo-app" icon="github" horizontal href="https://github.com/phrase/ios-demo-app" />

The Phrase iOS SDK fetches OTA translation releases at runtime and caches them on-device. If the OTA service is unreachable, the SDK falls back to the last cached translations or to the strings bundled in your app binary.

For more information on requirements and supported platforms, see the repository [README](https://github.com/phrase/ios-sdk).

## Installation

<CodeGroup>
  ```text Swift Package Manager theme={null}
  Add https://github.com/phrase/ios-sdk/ in Xcode under
  File → Add Package Dependency
  ```

  ```ruby CocoaPods theme={null}
  pod 'PhraseSDK'
  ```

  ```text Carthage theme={null}
  binary "https://raw.githubusercontent.com/phrase/ios-sdk/master/PhraseSDK.json" ~> 5.0.0
  ```
</CodeGroup>

For Carthage, run `carthage update --use-xcframeworks` after adding the entry. You can also download the latest release manually and link `PhraseSDK.xcframework` as a binary.

## Setup

Call `setup` before any strings are displayed, typically in `AppDelegate.application(_:didFinishLaunchingWithOptions:)` or at the entry point of your SwiftUI app:

```swift theme={null}
import PhraseSDK

Phrase.shared.setup(
    distributionID: "YOUR_DISTRIBUTION_ID",
    environmentSecret: "YOUR_ENVIRONMENT_SECRET"
)
```

Both values are available in [Phrase Strings](https://app.phrase.com/go/ota) after creating a distribution, or via the [Distributions API](/en/api/strings/introduction).

## Fetching and applying translations

```swift theme={null}
Task {
    do {
        let updated = try await Phrase.shared.updateTranslation()
        if updated {
            Phrase.shared.applyPendingUpdates()
        }
    } catch {
        // Falls back to cached or bundled translations automatically
    }
}
```

`applyPendingUpdates()` makes the new strings visible immediately. If omitted, they take effect on the next cold launch.

## Configuration options

```swift theme={null}
Phrase.shared.configuration.debugMode = true          // Enable verbose SDK logging
Phrase.shared.configuration.timeout = 20              // Network timeout in seconds (default: 10)
Phrase.shared.configuration.localeOverride = "en-US"  // Force a specific locale
Phrase.shared.configuration.ignoreOtherTables = true  // Only patch the default strings table
Phrase.shared.configuration.apiHost = .us             // Use the US data center (default: EU)
```
