2020-07-22 13:57:10 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
@main
|
|
|
|
struct WriteFreely_MultiPlatformApp: App {
|
2020-08-18 18:06:02 +00:00
|
|
|
@StateObject private var model = WriteFreelyModel()
|
2020-08-12 14:34:12 +00:00
|
|
|
|
|
|
|
#if os(macOS)
|
2020-08-12 14:21:15 +00:00
|
|
|
@State private var selectedTab = 0
|
2020-08-12 14:34:12 +00:00
|
|
|
#endif
|
2020-08-11 18:32:45 +00:00
|
|
|
|
2020-07-22 13:57:10 +00:00
|
|
|
var body: some Scene {
|
|
|
|
WindowGroup {
|
2020-08-18 18:06:02 +00:00
|
|
|
ContentView()
|
|
|
|
.environmentObject(model)
|
2020-08-13 18:54:56 +00:00
|
|
|
// .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info.
|
2020-07-22 13:57:10 +00:00
|
|
|
}
|
2020-08-07 20:30:09 +00:00
|
|
|
|
|
|
|
#if os(macOS)
|
|
|
|
Settings {
|
2020-08-12 14:21:15 +00:00
|
|
|
TabView(selection: $selectedTab) {
|
2020-08-18 18:06:02 +00:00
|
|
|
MacAccountView(account: model.account)
|
2020-08-12 14:36:49 +00:00
|
|
|
.tabItem {
|
|
|
|
Image(systemName: "person.crop.circle")
|
|
|
|
Text("Account")
|
2020-08-12 14:21:15 +00:00
|
|
|
}
|
2020-08-12 14:36:49 +00:00
|
|
|
.tag(0)
|
2020-08-18 18:06:02 +00:00
|
|
|
MacPreferencesView(preferences: model.preferences)
|
2020-08-12 14:36:10 +00:00
|
|
|
.tabItem {
|
|
|
|
Image(systemName: "gear")
|
|
|
|
Text("Preferences")
|
|
|
|
}
|
|
|
|
.tag(1)
|
2020-08-12 14:21:15 +00:00
|
|
|
}
|
|
|
|
.frame(minWidth: 300, maxWidth: 300, minHeight: 200, maxHeight: 200)
|
|
|
|
.padding()
|
2020-08-13 18:54:56 +00:00
|
|
|
// .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info.
|
2020-08-07 20:30:09 +00:00
|
|
|
}
|
|
|
|
#endif
|
2020-07-22 13:57:10 +00:00
|
|
|
}
|
|
|
|
}
|