Instance Method


Adds an action to perform when the user moves the pointer over or away from this view’s frame.


func onHover(perform action: @escaping (Bool) -> Void) -> some View



The action to perform whenever the pointer enters or exits this view’s frame. If the pointer is in the view’s frame, the action closure passes true as a parameter; otherwise, false.

Return Value

A view that triggers action when the pointer enters and exits this view’s frame.


Calling this method defines a region for detecting pointer movement with the size and position of this view.

See Also

Handling View Hover and Focus

func focusable(Bool, onFocusChange: (Bool) -> Void) -> View

Sets whether this view is focusable and, if so, adds an action to perform when the view comes into focus.


Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software