Refactor Navigation Toolbar into Separate View

This commit is contained in:
Sebastian Lenzlinger 2023-07-11 18:22:58 +02:00
parent 379d3c8a0e
commit 5e199f41f8
2 changed files with 39 additions and 41 deletions

View File

@ -29,16 +29,12 @@ struct ContentView: View {
FeedListView(feeds: []) FeedListView(feeds: [])
.environmentObject(dataStore) .environmentObject(dataStore)
} }
} HStack {
.padding()
.toolbar {
ToolbarItemGroup(placement: .bottomBar) {
Button(action: { Button(action: {
self.currentView = 0 self.currentView = 0
}) { }) {
VStack { VStack {
Label("Discovery", systemImage: "dot.radiowaves.left.and.right") Label("Discovery", systemImage: "dot.radiowaves.left.and.right")
Text("Discovery")
} }
} }
Spacer() Spacer()
@ -47,7 +43,6 @@ struct ContentView: View {
}) { }) {
VStack { VStack {
Label("Feeds", systemImage: "person.2") Label("Feeds", systemImage: "person.2")
Text("Feeds")
} }
} }
Spacer() Spacer()
@ -56,11 +51,13 @@ struct ContentView: View {
}) { }) {
VStack { VStack {
Label("Settings",systemImage: "gear") Label("Settings",systemImage: "gear")
Text("Settings")
} }
} }
} }
.frame(height: UIScreen.main.bounds.height * 0.05)
} }
.padding()
} }
} }

View File

@ -18,12 +18,6 @@ struct SettingsView: View {
List { List {
HStack {
Spacer()
Button("Edit") {
isPresentingEditView = true
}
}
Section(header: Text("Personal Feed ID")) { Section(header: Text("Personal Feed ID")) {
Label(dataStore.personalID, systemImage: "person.crop.circle") Label(dataStore.personalID, systemImage: "person.crop.circle")
} }
@ -34,6 +28,13 @@ struct SettingsView: View {
} }
} }
.navigationTitle("Settings") .navigationTitle("Settings")
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Edit") {
isPresentingEditView = true
}
}
}
.sheet(isPresented: $isPresentingEditView) { .sheet(isPresented: $isPresentingEditView) {
NavigationStack { NavigationStack {
SettingsEditView() SettingsEditView()