Move TabView into Settings block of app entrypoint to resolve Mac crash

This commit is contained in:
Angelo Stavrow 2020-08-12 10:21:15 -04:00
parent e06025c654
commit 0460ca73ca
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 27 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import SwiftUI
struct WriteFreely_MultiPlatformApp: App {
@StateObject private var preferences = PreferencesModel()
@StateObject private var account = AccountModel()
@State private var selectedTab = 0
#if DEBUG
@StateObject private var store = testPostStore
@ -19,10 +20,30 @@ struct WriteFreely_MultiPlatformApp: App {
#if os(macOS)
Settings {
SettingsView(preferences: preferences, account: account)
.frame(minWidth: 300, maxWidth: 300, minHeight: 200, maxHeight: 200)
.padding()
.preferredColorScheme(preferences.preferredColorScheme)
TabView(selection: $selectedTab) {
Form {
Section(header: Text("Login Details")) {
AccountView(account: account)
}
}
.tabItem {
Image(systemName: "person.crop.circle")
Text("Account")
}
.tag(0)
VStack {
PreferencesView(preferences: preferences)
Spacer()
}
.tabItem {
Image(systemName: "gear")
Text("Preferences")
}
.tag(1)
}
.frame(minWidth: 300, maxWidth: 300, minHeight: 200, maxHeight: 200)
.padding()
.preferredColorScheme(preferences.preferredColorScheme)
}
#endif
}

View File

@ -7,12 +7,12 @@
<key>WriteFreely-MultiPlatform (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
<key>WriteFreely-MultiPlatform (macOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>