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")
}

Element

  • 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 more

    Declaration

    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 or onSelect of another element.

    EditingMenu { menu in
        MyRow(text: "Hello, World") {
            menu.show()
        }
    } items: {
        EditingMenuItem.copying("A String")
    }
    
    See more

    Declaration

    Swift

    public final class MenuTrigger