systemOverlays
A HoverEffectGroup that becomes active when system overlays are visible.
Declaration
static var systemOverlays: HoverEffectGroup { get }Discussion
Use this group to synchronize effects with system overlays. In the following example, the back button will be hidden whenever system overlays are hidden.
Button("Back") { }
.hoverEffect(in: .systemOverlays) { e, isActive, _ in
e.animation(
isActive ? .systemOverlayAppearance : .systemOverlayDelayedDisappearance
) {
$0.opacity(isActive ? 1 : 0)
}
}
.persistentSystemOverlays(.hidden)This example uses the systemOverlayAppearance and systemOverlayDisappearance animations to ensure the effect using the same timing as system overlays.
If persistentSystemOverlays is not .hidden, this group will always be active.