You could use the Menu component instead of contextmenu like explained on stackoverflow
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: