Skip to documentation
DocumentationSDKs and frameworks

iOS

Deliver text through native Foundation localization with SwiftUI revision observation or UIKit rebinding.

Documented SDK 1.2.0

Requirements: iOS 15+, Swift tools 5.9+, Swift Package Manager

Package reference
On this page

Add the Swift package

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.

Package.swift · dependency

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

Initialize and observe SwiftUI updates

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: ""))
                .reRuneObserveRevision()
        }
    }
}

Initialize before displaying the app. Use NSLocalizedString through Bundle.main and the default Localizable table. The revision modifier refreshes views after delivered content changes. Direct Text("key"), LocalizedStringKey, and LocalizedStringResource do not use the OTA lookup path. Keep the same keys in ReRune and native resources.

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.

Rebind UIKit strings

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.

Choose an app language

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 reapply it after setup if it should survive restarts.

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.