mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Create a two-tab settings view for macOS
This commit is contained in:
parent
ea6e9491c2
commit
fb7c188ca0
@ -12,5 +12,12 @@ struct WriteFreely_MultiPlatformApp: App {
|
||||
WindowGroup {
|
||||
ContentView(postStore: store)
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
Settings {
|
||||
SettingsView()
|
||||
.frame(minWidth: 300, maxWidth: 600, minHeight: 200, maxHeight: 800)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
34
macOS/Settings/SettingsView.swift
Normal file
34
macOS/Settings/SettingsView.swift
Normal file
@ -0,0 +1,34 @@
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsView: View {
|
||||
@State var selectedView = 0
|
||||
|
||||
var body: some View {
|
||||
TabView(selection: $selectedView) {
|
||||
AccountLogin()
|
||||
.tabItem {
|
||||
Image(systemName: "person.crop.circle")
|
||||
Text("Account")
|
||||
}
|
||||
.tag(0)
|
||||
Preferences()
|
||||
.tabItem {
|
||||
Image(systemName: "gear")
|
||||
Text("Preferences")
|
||||
}
|
||||
.tag(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct SettingsView_AccountTabPreviews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SettingsView(selectedView: 0)
|
||||
}
|
||||
}
|
||||
|
||||
struct SettingsView_PreferencesTabPreviews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SettingsView(selectedView: 1)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user