SwiftUI: Uppercase a localized string for a view, e.g. `Text`?
It is now possible with all new textCase
ViewModifier (Xcode 12 Beta 3), like so:
Text("SignIn.Body.Instruction")
.textCase(.uppercase)
Or lowercase
:
Text("SignIn.Body.Instruction")
.textCase(.lowercase)
How about using the smallCaps
modifier for Font
? E.g., Text("Hello World").font(Font.body.smallCaps())
will render "HELLO WORLD"
, but the underlying string will retain its proper localized capitalization for the purposes of accessibility.