Xcode 27 introduces AI-powered coding agents that can translate your entire app's String Catalogs directly inside the IDE, leveraging rich context (code location, usage comments, plural variations, cross-language consistency) to produce high-quality, context-aware localizations without leaving Xcode.
โข Agents use String Catalog metadata โ where and how strings are used โ to resolve ambiguous terms (e.g. 'book' as noun vs verb) and pick the correct translation, dramatically reducing post-translation fixes.
โข Plural variations, right-to-left layout, and language-specific style guides are handled automatically, including reusing terminology from prior translations for cross-feature consistency.
โข The tight feedback loop (agent renders UI in the target language, flags truncations and clipping) lets you catch localization layout bugs during development rather than after shipping.
Shows how to structure a SwiftUI view so Xcode's agent receives maximum context โ using String(localized:comment:) and explicit plural-capable Text initializers โ resulting in higher-quality agent translations stored in a String Catalog.
import SwiftUI
// MARK: - Model
struct Landmark: Identifiable {
let id = UUID()
let name: String
}
// MARK: - Main View
struct LandmarksView: View {
let landmarks: [Landmark]
var body: some View {
VStack(spacing: 16) {
// Text() in SwiftUI is localizable by default.
// The string literal becomes a key in Localizable.xcstrings.
Text("Explore Landmarks")
.font(.largeTitle)
.bold()
// String(localized:comment:) gives the Xcode agent
// a disambiguation comment โ critical for polysemous words.
let bookingPrompt = String(
localized: "Book a visit",
comment: "Button label: reserve/schedule a visit to a landmark. NOT 'book' as in a physical book."
)
Button(bookingPrompt) {
// handle booking
}
.buttonStyle(.borderedProminent)
// Plural-aware string: Xcode agent auto-generates
// the correct plural variations per locale in the .xcstrings file.
Text("^[\(landmarks.count) attraction](inflect: true)")
.foregroundStyle(.secondary)
// Explicitly localized count string with comment for the agent
let countLabel = String(
localized: "\(landmarks.count) landmarks to discover",
comment: "Footer label showing how many landmarks remain. 'landmarks' here means tourist attractions, not map pins."
)
Text(countLabel)
.font(.footnote)
}
.padding()
}
}
// MARK: - Preview
#Preview {
LandmarksView(landmarks: [
Landmark(name: "Eiffel Tower"),
Landmark(name: "Colosseum"),
Landmark(name: "CN Tower")
])
}Agents translate in batches via subagents โ very large projects may take several minutes; leave Xcode running. AGENTS.md / TRANSLATION.md guidance files must be committed to the project root for agents to respect glossaries and tone instructions. Always validate results with native speakers via TestFlight before shipping โ agents cannot guarantee cultural nuance for all locales. String Catalogs must already exist or Xcode will auto-create them, which may surprise teams using older .strings workflows.
Requires an Apple Intelligence-capable Mac running Xcode 27; agent features depend on on-device or cloud LLM availability configured in Xcode settings.
More iOS 27 APIs land every week.
Get notified when new capabilities are published โ no noise, just signal.