Post

Replies

Boosts

Views

Activity

Contex menu in List: bug or feature?
Hello!A have a problem: when I use the context menu on some subview in a complex view that used in List then this context menu is applied to all complex views (row view in the list):import SwiftUI struct ComplexViewWithOneElementWithContextMenu: View { var body: some View { VStack { Image(systemName: "trash") .resizable() .aspectRatio(contentMode: .fit) .frame(width: 200) .contextMenu(ContextMenu { Button("A") {} Button("B") {} }) Text("I don’t want to show in preview because I don’t have context menu modifire").bold() } } } struct ContentView: View { var body: some View { List { ComplexViewWithOneElementWithContextMenu() ComplexViewWithOneElementWithContextMenu() } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }Help me to understand this behavior, please.
0
1
642
Feb ’20