Live language changing.
This commit is contained in:
@@ -11,7 +11,6 @@ import SwiftUI
|
|||||||
struct Nextcloud_Cookbook_iOS_ClientApp: App {
|
struct Nextcloud_Cookbook_iOS_ClientApp: App {
|
||||||
@StateObject var userSettings = UserSettings()
|
@StateObject var userSettings = UserSettings()
|
||||||
@StateObject var mainViewModel = MainViewModel()
|
@StateObject var mainViewModel = MainViewModel()
|
||||||
@State(initialValue: "en") var language: String
|
|
||||||
|
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup {
|
WindowGroup {
|
||||||
@@ -26,11 +25,7 @@ struct Nextcloud_Cookbook_iOS_ClientApp: App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.transition(.slide)
|
.transition(.slide)
|
||||||
.onAppear {
|
.environment(\.locale, .init(identifier: userSettings.language))
|
||||||
language = userSettings.language
|
|
||||||
print(userSettings.language)
|
|
||||||
}
|
|
||||||
.environment(\.locale, .init(identifier: language))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user