Refactor PreferenceView to punt Form/Section up to SettingsView

This commit is contained in:
Angelo Stavrow 2020-08-10 13:51:07 -04:00
parent a7b918c14b
commit 8f9d1746fb
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 24 additions and 18 deletions

View File

@ -12,15 +12,12 @@ struct PreferencesView: View {
}
.pickerStyle(SegmentedPickerStyle())
#elseif os(macOS)
Form {
Picker(selection: $appearance, label: Text("Appearance")) {
Text("System").tag(0)
Text("Light Mode").tag(1)
Text("Dark Mode").tag(2)
}
.frame(width: 200, height: 100, alignment: .topLeading)
.pickerStyle(RadioGroupPickerStyle())
Picker(selection: $appearance, label: EmptyView()) {
Text("System").tag(0)
Text("Light Mode").tag(1)
Text("Dark Mode").tag(2)
}
.pickerStyle(RadioGroupPickerStyle())
#endif
}
}

View File

@ -5,18 +5,27 @@ struct SettingsView: View {
var body: some View {
TabView(selection: $selectedView) {
AccountView()
.tabItem {
Image(systemName: "person.crop.circle")
Text("Account")
Form {
Section(header: Text("Log in to your account")) {
AccountView()
}
.tag(0)
PreferencesView()
.tabItem {
Image(systemName: "gear")
Text("Preferences")
}
.tabItem {
Image(systemName: "person.crop.circle")
Text("Account")
}
.tag(0)
Form {
Section(header: Text("Appearance")) {
PreferencesView()
Spacer()
}
.tag(1)
}
.tabItem {
Image(systemName: "gear")
Text("Preferences")
}
.tag(1)
}
}
}