moko-resources
moko-resources copied to clipboard
SwiftUI - Autoupdate Text-Object
I use MokoMVVM and MokoResources in an app built with Compose and SwiftUI.
I know that I can change the language of the entire app by setting it like this:
StringDesc.localeType = StringDesc.LocaleType.Custom("es")
How do I have to use the String-Resources in a SwiftUI-Text-Object so that it would update the texts in the app automatically?
Currently I use this Swift-Extension:
extension ResourcesStringResource { func translate() -> String { return StringHelper().getString(id: self).localized() } }
And I show the text like this:
Text(MR.strings().txtMyString.translate())
Any suggestions?
i don't know how to implement this feature :)