Hello Team of Devs,
I'm trying to use a card with to actions, the first action is when I press it show me a list (it works) and the second action it's when I made a long pressure on the card it show me a menu, for that Menu I'm using ContextMenu, I'm using a navigationLink to show me a part that it let me Edit the card, but it doesn't show me the information that I want, for example I have a 4 card, and when y use contexMenu with card 1 it show me information of card 3.
This is the code.
VStack{
Grid{
LazyVGrid(columns: adaptiveColumns, spacing : 10){
ForEach($list) { $Category in
NavigationLink(destination: CategoryList(list: $Category)){
Card(list: Category).frame(height: 100)
.contextMenu{
Button {
// self.selectedCategory = $Category
editCategory = true
} label: {
Text("Edit")
}
}
}
}
background{
ForEach($list) { $list in
NavigationLink("", destination: DetailCardView(list: $list), isActive : $editCategory)
}
}
}
}
}
The background it's the code that I want that charge when I press the card using contexMenu