Hi,
my SwiftUI app is localized by using translation files (German, English).
In one of my views I have to present a text received by a webservice. The webservice provides the text in German and English.
What is the best practice to show the correct string?
First idea: Check the current locale, if it is German than show the German text, else show the English one.
Is this the best way to implement this?
Second idea: Is there a possibility to use NSLocalizedString without a language file and to provide the translations programmatically? In this case I wouldn't have to check the locale on myself. therefore I would prefer this...
Thanks in advance!
Mark
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
SwiftUI's TabView seems to have problems when being used in a sidebar on iPad.
This example works completely fine on iPhone, only iPad makes problems:
NavigationView{
TabView{
Text("Test 1").tabItem{
Image(systemName: "folder")
}
Text("Test 2").tabItem{
Image(systemName: "tag")
}
Text("Test 3").tabItem{
Image(systemName: "star")
}
}
}
The tabbar width is not calculated correctly and as a result not all buttons are shown. In the screenshot there should be three buttons visible, but only 2 are shown, "folder" is missing:
Has someone a solution or workaround for this?
I have tested this with iOS 17 and 17.2.