SwiftUI Native Components

Because SwiftUI executes LocalizedStringKey directly at compile time, Apple bypasses the standard Bundle.localizedString mechanisms used natively by UIKit.

To perfectly intercept strings over the air inside SwiftUI without complex Environment variables, LangCat provides extremely lightweight, drop-in wrapped components. Because we utilize native @_disfavoredOverload tags, dropping in LCText ensures your Xcode compiler still automatically parses and extracts your strings to your .xcstrings catalog!

Available Component Wrappers

Apple NativeLangCat Replacement
Text("key")LCText("key")
Label("key", systemImage: "x")LCLabel("key", ...)
Button("Submit")LCButton("Submit")
TextField("Account", text:)LCTextField(...)
SecureField("Password", text:)LCSecureField(...)
Toggle("Notify", isOn:)LCToggle(...)
DatePicker("Date", selection:)LCDatePicker(...)

Usage Example

Standard Native
Settings.swift
VStack {
Text("settings_title")
Button("logout_btn") {
signOut()
}
}
LangCat OTA
Settings.swift
VStack {
LCText("settings_title")
LCButton("logout_btn") {
signOut()
}
}

Programmatic Assessment

If you encounter a custom SwiftUI component or un-wrapped modifier that strictly requires a String representation of your localization rather than a View, use the static engine directly:

Settings.swift
Text(LangCat.localize("hello_world"))
// Used directly inside modifiers
NavigationLink(
LangCat.localize("continue_btn"),
destination: NextView()
)