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.
Apply the effect with hoverEffect(.lift)
You rarely construct LiftHoverEffect directly; instead you attach it through the
hoverEffect(_:)view modifier using the.liftshorthand, which resolves to a LiftHoverEffect value. In the example,.hoverEffect(.lift)is chained onto the styledLabel, marking it as the view that should rise when hovered.Conform through the HoverEffect protocol
LiftHoverEffect conforms to the HoverEffect protocol, the same family that includes
.highlightand.automatic. That shared conformance is what lets the static.liftmember stand in wherever a hover effect is expected, so you can swap it for another effect without changing the surrounding modifier chain.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, tintedLabelrectangle is what lifts as a single unit toward the viewer.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.
.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.
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()
}
}