Hi
The background is I have 2 Views
- Parent View → Detail View
- the Detail View is defined as a function that return some view inside the parent view class (not in separate file)
- Parent View has a NavigationStack that has Navigation Link inside which will lead you to the detail view
- in detail view, automatically there is back where you can go back to parent view
- in detail view, I added a save button, to which I want to go back to parent view when save is done
" And there came my PROBLEM" I could not switch the view back to parent programmatically
before there was isPresentedBinding/isActive but it seems its already deprecated
struct GenericManageView: View {
...
var body: some View {
NavigationStack() {
List(items, id: \.self) { item in
NavigationLink {
editItemView(lItem: item)
} label: {
listItemView(lItem: item)
}
}
}
}// end of view body
func editItemView(lItem: Item) -> some View {
// display a save button here that will switch view back to body when successfully saved core data
}
}