In UiKit, pressing with 3D Touch enables Peek and Pop to preview content quickly and provide contextual menu actions, creating a great interactive experience. In SwiftUI, we can interact with the popup menu, and using ContextMenu can achieve a similar experience to UiKit. This article will introduce the use of the .contextMenu modifier to trigger the context menu with a long press and combine Menu and Button to add submenus.
References:
ContextMenu in SwiftUI
Follow me on:
Kommentare