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: [])
.environmentObject(dataStore)
}
}
.padding()
.toolbar {
ToolbarItemGroup(placement: .bottomBar) {
HStack {
Button(action: {
self.currentView = 0
}) {
VStack {
Label("Discovery", systemImage: "dot.radiowaves.left.and.right")
Text("Discovery")
}
}
Spacer()
@ -47,7 +43,6 @@ struct ContentView: View {
}) {
VStack {
Label("Feeds", systemImage: "person.2")
Text("Feeds")
}
}
Spacer()
@ -56,11 +51,13 @@ struct ContentView: View {
}) {
VStack {
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 {
HStack {
Spacer()
Button("Edit") {
isPresentingEditView = true
}
}
Section(header: Text("Personal Feed ID")) {
Label(dataStore.personalID, systemImage: "person.crop.circle")
}
@ -34,6 +28,13 @@ struct SettingsView: View {
}
}
.navigationTitle("Settings")
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Edit") {
isPresentingEditView = true
}
}
}
.sheet(isPresented: $isPresentingEditView) {
NavigationStack {
SettingsEditView()