# iOS

Source: https://rerune.io/docs/ios

Set up the ReRune iOS SDK to deliver text through native Foundation localization with SwiftUI revision observation or UIKit rebinding.

Package: ReRune 1.7.0. Requirements: iOS 15+, Swift tools 5.9+, Swift Package Manager. Overview: https://rerune.io/ios-localization-sdk

## Add the Swift package

Source: https://rerune.io/docs/ios#install

Add the ReRune repository through Xcode Swift Package Manager or your Package.swift dependencies. Link the ReRune product to the app target. Keep native fallback resources in the application bundle. ReRune ships a privacy manifest that declares no tracking, no collected data, and no required reason APIs.

Package.swift · dependency:

```
.package(url: "https://github.com/BasalBit/rerune-ios.git", from: "1.7.0")
```

> **Before you upgrade:** Android SDK 1.8.0 and iOS SDK 1.7.0 still skip a whole language update when one published translation uses a placeholder your app does not provide, expects a different type of value, or has a placeholder that is not declared on its key. Users keep the last version that worked. With checkOnStart on, the default, both also check for updates whenever the app returns to the foreground. Android: after the upgrade each language downloads once more, a saved variant falls back to the setup variant, and remembered rejected versions are forgotten. reRuneObserveRevision now refreshes texts in place and keeps remembered state, and getString with format arguments that do not fit your own text throws, as Android does. iOS: 1.7.0 adds, removes, and changes no public API, so upgrading from 1.6.1 needs no source change. A persisted reRuneSetVariant or reRuneResetVariant call that is still running when a later reRuneSetup reads the saved selection no longer saves, so call reRuneSetVariant again after the new setup when the choice should still apply. When you upgrade from 1.5.x, keys your app ships only in its development language are also checked, so a language that 1.5.0 applied can be rejected. A remote value with arguments for a key your app does not ship is used only when the lookup passes a matching default value, and SwiftUI Text("key") shows ReRune values.

## Initialize and observe SwiftUI updates

Source: https://rerune.io/docs/ios#swiftui

Swift · application entry point:

```
import SwiftUI
import ReRune

@main
struct ExampleApp: App {
    init() {
        reRuneSetup(otaPublishId: "<READ_ONLY_OTA_PUBLISH_ID>")
    }

    var body: some Scene {
        WindowGroup {
            Text(NSLocalizedString("headline", comment: ""))
                // Needed only below iOS 17; deprecated on iOS 17 and later.
                .reRuneObserveRevision()
        }
    }
}
```

Call the first reRuneSetup before the app shows its first screen. SwiftUI Text("key") and views that take a key, such as Button, Label, Toggle, and navigationTitle, show ReRune values. SwiftUI resolves them when it creates the view, so a view already on screen can keep its previous text. For text that must update on a visible screen, look it up with NSLocalizedString in body. On iOS 17 and later those views update by themselves. Before iOS 17, add the revision modifier once near the top of each screen, which also resets scroll position and text input. ReRune serves only the default Localizable table of Bundle.main. String(localized:), LocalizedStringResource, and AttributedString(localized:) do not receive ReRune translations. Use the same keys in ReRune and in your bundled resources, and ship a value for every key you format with arguments.

Format plurals with NSLocalizedString and String.localizedStringWithFormat. Foundation uses the device formatting locale for plural rules, even when reRuneSetLocale selects a different OTA language. A plural control chooses the form; the count appears in the output only when that form references it.

- [iOS plural formatting reference](https://github.com/BasalBit/rerune-ios/blob/1.7.0/README.md#plural-strings)

## Rebind UIKit strings

Source: https://rerune.io/docs/ios#uikit

After setup, assign strings through NSLocalizedString as usual. Subscribe to reRuneRevisionPublisher, retain the subscription, and update text properties on existing views when a revision arrives. The SDK cannot reassign a label text property that your application set earlier.

- [UIKit setup and revision publisher](https://github.com/BasalBit/rerune-ios/blob/1.7.0/README.md#uikit-quick-start)

## Choose an app language

Source: https://rerune.io/docs/ios#locale

Swift · select German, then return to system preference:

```
reRuneSetLocale("de")
reRuneSetLocale(nil)
```

Build the picker from reRuneAvailableLocales or reRuneAvailableLocaleDetails. A dashboard-only language becomes available after a successful fetch or cache restoration. Persist an explicit language choice in your app and pass it to reRuneSetLocale right before reRuneSetup on the next launch, so setup starts in that language. ReRune does not save the selection, and every later reRuneSetup clears it.

Runtime language selection changes app text lookup. It does not change iOS Settings language lists, App Store metadata, or native system strings. Keep bundled fallback content and ship a new app version for code or resource changes.

- [Preview drafts with OTA staging](https://rerune.io/docs/staging#sdk-setup)

- [iOS SDK reference](https://github.com/BasalBit/rerune-ios/blob/1.7.0/README.md)
- [Swift Package Index](https://swiftpackageindex.com/BasalBit/rerune-ios)

---

Part of the ReRune documentation (https://rerune.io/docs). Every chapter with a summary: https://rerune.io/llms.txt. Every chapter in one file: https://rerune.io/llms-full.txt. ReRune is not Rerun (rerun.io), the robotics data visualization tool.
