mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Implement color scheme switching on Mac app
This commit is contained in:
parent
6dba087295
commit
264298160b
@ -19,7 +19,7 @@ struct WriteFreely_MultiPlatformApp: App {
|
||||
|
||||
#if os(macOS)
|
||||
Settings {
|
||||
SettingsView(preferences: preferences)
|
||||
SettingsView(preferences: preferences, account: account)
|
||||
.frame(minWidth: 300, maxWidth: 300, minHeight: 200, maxHeight: 200)
|
||||
.padding()
|
||||
.preferredColorScheme(preferences.preferredColorScheme)
|
||||
|
@ -2,6 +2,7 @@ import SwiftUI
|
||||
|
||||
struct SettingsView: View {
|
||||
@ObservedObject var preferences: PreferencesModel
|
||||
@ObservedObject var account: AccountModel
|
||||
|
||||
@State var selectedView = 0
|
||||
|
||||
@ -9,7 +10,7 @@ struct SettingsView: View {
|
||||
TabView(selection: $selectedView) {
|
||||
Form {
|
||||
Section(header: Text("Login Details")) {
|
||||
AccountView()
|
||||
AccountView(account: account)
|
||||
}
|
||||
}
|
||||
.tabItem {
|
||||
@ -32,12 +33,12 @@ struct SettingsView: View {
|
||||
|
||||
struct SettingsView_AccountTabPreviews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SettingsView(preferences: PreferencesModel(), selectedView: 0)
|
||||
SettingsView(preferences: PreferencesModel(), account: AccountModel(), selectedView: 0)
|
||||
}
|
||||
}
|
||||
|
||||
struct SettingsView_PreferencesTabPreviews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SettingsView(preferences: PreferencesModel(), selectedView: 1)
|
||||
SettingsView(preferences: PreferencesModel(), account: AccountModel(), selectedView: 1)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user