swiftui-multiplatform/Shared/WriteFreely_MultiPlatformApp.swift

41 lines
1.2 KiB
Swift
Raw Normal View History

2020-07-22 13:57:10 +00:00
import SwiftUI
@main
struct WriteFreely_MultiPlatformApp: App {
@StateObject private var model = WriteFreelyModel()
#if os(macOS)
@State private var selectedTab = 0
#endif
2020-07-22 13:57:10 +00:00
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(model)
// .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info.
2020-07-22 13:57:10 +00:00
}
#if os(macOS)
Settings {
TabView(selection: $selectedTab) {
MacAccountView(account: model.account)
.tabItem {
Image(systemName: "person.crop.circle")
Text("Account")
}
.tag(0)
MacPreferencesView(preferences: model.preferences)
.tabItem {
Image(systemName: "gear")
Text("Preferences")
}
.tag(1)
}
.frame(minWidth: 300, maxWidth: 300, minHeight: 200, maxHeight: 200)
.padding()
// .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info.
}
#endif
2020-07-22 13:57:10 +00:00
}
}