Menu

Moving iOS count strings to Xcode's generated string symbols
📰

Moving iOS count strings to Xcode's generated string symbols

DEV Community: swift·Darkø Tasevski·about 18 hours ago
#kvrfs62b
#devtoswift#devto#dev#expect#locale
Long article (1202 words) — no AI summary yet.
Reading 0:00
15s threshold

These are some notes from moving the count strings in a SwiftUI app ("3 books", "1 session", that kind of thing) off NSString(format:) and onto the typed LocalizedStringResource symbols that Xcode generates from String Catalogs. The app keeps its features in a Swift package with its own .xcstrings catalogs and ships in about twenty locales, and the whole thing started from a small bug where a VoiceOver label read out a raw key instead of its text, because the key was paired with the wrong table.

You already have the generated symbols

The first thing worth knowing is that you don't need to write or check in any generated layer for this. At build time Xcode generates a LocalizedStringResource member for every manually added catalog entry, and it does that for Swift package targets too, not only for the app target.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.