EditingMenu
public struct EditingMenu : Element
Allows showing the system’s UIMenuController
editing menu.
You can show the menu upon tap or long press:
myElement.editingMenu(show: .onLongPress) {
EditingMenuItem.copying("A String")
EditingMenuItem(.select) {
print("Selected!")
}
}
You can also show the menu as a result of another element’s onTap
closure,
using the trigger-based API:
EditingMenu { menu in
MyRow(text: "Hello, World") {
menu.show()
}
} items: {
EditingMenuItem.copying("A String")
}
-
The wrapped element to display.
Declaration
Swift
public var wrapped: Element
-
The editing items to show in the editing menu.
Declaration
Swift
public var items: [EditingMenuItem]
-
Creates a new editing menu, wrapping the provided element, and displaying the provided items.
Declaration
Swift
public init( show gesture: Gesture, wrapping: Element, @Builder<EditingMenuItem> with items: () -> [EditingMenuItem] )
-
Creates a new editing menu, wrapping the provided element, and displaying the provided items.
Declaration
Swift
public init( wrapping: (MenuTrigger) -> Element, @Builder<EditingMenuItem> items: () -> [EditingMenuItem] )
-
Declaration
Swift
public var content: ElementContent { get }
-
Declaration
Swift
public func backingViewDescription(with context: ViewDescriptionContext) -> ViewDescription?
-
The gesture to use to show the menu.
See moreDeclaration
Swift
public enum Gesture
-
A trigger that you can use to show the menu based on the result of some other action firing, such as the
onTap
oronSelect
of another element.
See moreEditingMenu { menu in MyRow(text: "Hello, World") { menu.show() } } items: { EditingMenuItem.copying("A String") }
Declaration
Swift
public final class MenuTrigger