I started playing around with the navigationDestination modifier. But currently it always re-routes me back to the list with the entries. Does someone have an idea why this happens?
MainView
NavigationStack {
Form {
Section {
ProgressRing(percentage: $percentage)
Text("1 of 3 compleatet")
.font(.title2)
.fontWeight(.medium)
.foregroundStyle(Color.accentColor)
}
.listRowBackground(Color.clear)
.listRowSeparator(.hidden)
.frame(maxWidth: .infinity ,alignment: .center)
.padding()
Section("Daily tasks") {
NavigationLink {
EmptyView()
} label: {
Label("Log mood", systemImage: "seal")
}
NavigationLink {
QuoteView()
} label: {
Label("Quote Gallery", systemImage: "seal")
}
NavigationLink {
GratitudeListView()
} label: {
Label("Writing down gratitude", systemImage: "seal")
}
}
}
.navigationTitle("Hello, \(users.first?.name ?? "User")")
}
List {
ForEach(gratitudes, id: \.self) { gratitude in
NavigationLink(value: gratitude) {
VStack(alignment: .leading) {
Text(gratitude.gratitude1)
Text(gratitude.createdAt, style: .date)
}
}
}
.navigationDestination(for: Gratitude.self, destination: { gratitude in
GratitudeUpdateView(gratitude: gratitude)
})
}
.navigationTitle("Gratitude")
.toolbar(.hidden, for: .tabBar)
.overlay(alignment: .bottom) {
NavigationLink {
GratitudeAddView()
} label: {
PlusButton()
}
}