skip to Main Content

Is there a way to disable automatic extraction when using String Catalog?

The following code block invokes an initializer with LocalizedStringKey and not with StringProtocol.

Text("Hello World!")

Text has a workaround for this in a form of init(verbatim:). But the same functionality doesn’t exist for other UI elements—Button, TextField, etc.

I was looking for more global solution. But using String("Hello World!") or "Hello World!".toString everywhere seems excessive.

2

Answers


  1. Yes you can do so by updating the following build settings in your target:

    • Localized String SwiftUI Support (LOCALIZED_STRING_SWIFTUI_SUPPORT): NO
    • Use Compiler to Extract Swift Strings (SWIFT_EMIT_LOC_STRINGS): NO
    Login or Signup to reply.
  2. Text(verbatim: "Hello World!")

    This will not update your string in string catalog

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search