Instance Method

onSelect(_:)

Runs a closure when the menu item is selected.

Declaration

func onSelect(_ handler: @escaping () -> ()) -> Self

Example


MenuItem("Click Me")
    .onSelect {
        print("Hello, world!")
    }

See Also

Behavior