Contents

zOffset

A value that represents the normalized distance between the screen and a hovering pointing device, such as Apple Pencil.

Declaration

var zOffset: CGFloat { get }

Discussion

This value is 1 at the maximum distance from the screen and approaches 0 as the pointing device gets closer to the screen. This value is 0 for devices that don’t support zOffset.

For example, a drawing app might use the value of this property to generate a preview that indicates where a hovering Apple Pencil touches down on an iPad screen. For more information, see Adopting hover support for Apple Pencil.

See Also

Supporting Apple Pencil hover