---
title: HoverPhase
framework: swiftui
role: symbol
role_heading: Enumeration
path: swiftui/hoverphase
---

# HoverPhase

The current hovering state and value of the pointer.

## Declaration

```swift
@frozen enum HoverPhase
```

## Overview

Overview When you use the onContinuousHover(coordinateSpace:perform:) modifier, you can handle the hovering state using the action closure. SwiftUI calls the closure with a phase value to indicate the current hovering state. The following example updates hoverLocation and isHovering based on the phase provided to the closure: @State private var hoverLocation: CGPoint = .zero @State private var isHovering = false

var body: some View {     VStack {         Color.red             .frame(width: 400, height: 400)             .onContinuousHover { phase in                 switch phase {                 case .active(let location):                     hoverLocation = location                     isHovering = true                 case .ended:                     isHovering = false                 }             }             .overlay {                 Rectangle()                     .frame(width: 50, height: 50)                     .foregroundColor(isHovering ? .green : .blue)                     .offset(x: hoverLocation.x, y: hoverLocation.y)             }     } }

## Topics

### Getting hover phases

- [HoverPhase.active(_:)](swiftui/hoverphase/active(_:).md)
- [HoverPhase.ended](swiftui/hoverphase/ended.md)

## Relationships

### Conforms To

- [BitwiseCopyable](swift/bitwisecopyable.md)
- [Copyable](swift/copyable.md)
- [Equatable](swift/equatable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Responding to hover events

- [onHover(perform:)](swiftui/view/onhover(perform:).md)
- [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)
- [HoverEffectPhaseOverride](swiftui/hovereffectphaseoverride.md)
- [OrnamentHoverContentEffect](swiftui/ornamenthovercontenteffect.md)
- [OrnamentHoverEffect](swiftui/ornamenthovereffect.md)
