I have a ForEach loop which displays around 7 buttons in a dashboard view. I want to track each button action and display a new screen based on the button pressed. I am stuck here. Someone pls advice and help.
Navigate to new view from a click of a button
If your view looks something like this, you can use a NavigationLink and a parameter in the new view to determine which button was pressed
Code Block Swift ForEach(items, id: \.name) { item in NavigationLink(item.name, destination: DetailView(id: item.name)) }