swiftui-multiplatform/Shared/WriteFreely_MultiPlatformApp.swift

47 lines
1.3 KiB
Swift
Raw Normal View History

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