Instance Method

view(_:)

Display a custom NSView instead of the title or attributed title.

Declaration

func view(_ view: NSView) -> Self

Discussion

The title string must still be specified in order to enable type-to-select to work. You are responsible for drawing the highlighted state (based on enclosingMenuItem.isHighlighted).

Example


MenuItem("\(server.name) is \(server.status.description)")
    .view(ServerStatusView(server: server))

See Also

Appearance