---
title: "onHover(perform:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/onhover(perform:)"
---

# onHover(perform:)

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

## Declaration

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

```

## Parameters

- `action`: 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

Return Value A view that triggers action when the pointer enters or exits this view’s frame.

## Discussion

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

## See Also

### Responding to hover events

- [onContinuousHover(coordinateSpace:perform:)](swiftui/view/oncontinuoushover(coordinatespace:perform:).md)
- [hoverEffect(_:isEnabled:)](swiftui/view/hovereffect(_:isenabled:).md)
- [hoverEffectDisabled(_:)](swiftui/view/hovereffectdisabled(_:).md)
- [defaultHoverEffect(_:)](swiftui/view/defaulthovereffect(_:).md)
- [isHoverEffectEnabled](swiftui/environmentvalues/ishovereffectenabled.md)
- [HoverPhase](swiftui/hoverphase.md)
- [HoverEffectPhaseOverride](swiftui/hovereffectphaseoverride.md)
- [OrnamentHoverContentEffect](swiftui/ornamenthovercontenteffect.md)
- [OrnamentHoverEffect](swiftui/ornamenthovereffect.md)
