TechnologiesSwiftUIHover and Pointer Effects

LiftHoverEffect struct

iOSmacOStvOSwatchOSvisionOS✓ renders

A hover effect that slides the pointer under the view and disappears as the

How it works

LiftHoverEffect is a built-in hover effect that raises a view toward the viewer—growing it slightly and casting a soft shadow—while a pointer or other indirect input device hovers over it. It gives interactive elements a sense of depth and tactility, signaling to the reader that a control is targetable before they commit to a tap or click. Reach for it on platforms that support pointer interactions, such as iPadOS with a trackpad or visionOS, when you want a focused element to feel like it physically lifts off the surface.

  1. Apply the effect with hoverEffect(.lift)

    You rarely construct LiftHoverEffect directly; instead you attach it through the hoverEffect(_:) view modifier using the .lift shorthand, which resolves to a LiftHoverEffect value. In the example, .hoverEffect(.lift) is chained onto the styled Label, marking it as the view that should rise when hovered.

  2. Conform through the HoverEffect protocol

    LiftHoverEffect conforms to the HoverEffect protocol, the same family that includes .highlight and .automatic. That shared conformance is what lets the static .lift member stand in wherever a hover effect is expected, so you can swap it for another effect without changing the surrounding modifier chain.

  3. Define the hover target's shape and bounds

    The lift animates the view as the system sees it, so the modifier's position in the chain matters. Here .hoverEffect(.lift) follows .background(.tint, in: RoundedRectangle(cornerRadius: 12)) and .padding(), meaning the rounded, tinted Label rectangle is what lifts as a single unit toward the viewer.

  4. Let the system drive the animation

    LiftHoverEffect carries no tuning parameters of its own—the platform owns the scale, shadow, and timing curves so the motion stays consistent with system controls. You opt in by naming .lift, and SwiftUI handles raising the view on hover-enter and settling it back on hover-exit automatically.

Try it — Change .hoverEffect(.lift) to .hoverEffect(.highlight) and hover again to see how the lift's depth-and-shadow rise differs from the flatter highlight treatment on the same Label.

Example & preview

Press Run live & edit to compile it in your browser — then edit the Swift on the left and the preview re-renders live.

LiftHoverEffect.swift
struct LiftHoverEffectDemo: View {
    var body: some View {
        Label("Hover to Lift", systemImage: "hand.point.up.left")
            .font(.headline)
            .padding()
            .background(.tint, in: RoundedRectangle(cornerRadius: 12))
            .foregroundStyle(.white)
            .hoverEffect(.lift)
            .padding()
    }
}
Live preview
Hover to Lift
Hover to Lift
swift → lexer → parser → sema → uiir → canvas Open in Studio ↗
What's new in SwiftUI 27 →