ContextMenu
struct · iOS 13.0+ · Deprecated in iOS 100000.0 · SDK 27.1
struct ContextMenu<MenuItems> where MenuItems : ViewA container for views that you present as menu items in a context menu. A context menu view allows you to present a situationally specific menu that enables taking actions relevant to the current task. You can create a context menu by first defining a `ContextMenu` container with the controls that represent the actions that people can take, and then using the ``View/contextMenu(_:)`` view modifier to apply the menu to a view. The example below creates and applies a two item context menu container to a ``Text`` view. The Boolean value `shouldShowMenu`, which defaults to true, controls the availability of context menu: private let menuItems = ContextMenu { Button { // Add this item to a list of favorites. } label: { Label("Add to Favorites", systemImage: "heart") } Button { // Open Maps and center it on this item. } label: { Label("Show in Maps", systemImage: "mappin") } } private struct ContextMenuMenuItems: View { @State private var shouldShowMenu = true var body: some View { Text("Turtle Rock") .contextMenu(shouldShowMenu ? menuItems : nil) } } 
Members (0)
This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.
Skipped declarations
1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
ContextMenu.init(menuItems:)
callback cannot propagate synchronous failure