One Logo Pool Ball
SwiftUI · IOS API REFERENCE

PencilHoverPose

struct · iOS 17.5+ · SDK 27.1

struct PencilHoverPose

A value describing the location and distance of an Apple Pencil hovering in the area above a view’s bounds.

Members (6)

get · iOS 17.5+

roll

TypeScript
get roll(): _SwiftUICore_Angle
Swift declaration
let roll: Angle

A value that represents the barrel roll angle of the hovering Apple Pencil. This value is `.zero` when the user starts using their Apple Pencil, and changes relative to that initial angle as the user rolls the Apple Pencil alongside its barrel. If the Apple Pencil doesn't support detecting its barrel roll angle, this property is always `.zero`.

get · iOS 17.5+

anchor

TypeScript
get anchor(): _SwiftUICore_UnitPoint
Swift declaration
let anchor: UnitPoint

The location of an Apple Pencil hovering in the area above the view’s bounds, expressed as a normalized anchor point relative to that view. You can pass this anchor point directly to a presentation modifier like ``View/popover(isPresented:attachmentAnchor:arrowEdge:content:)`` or use the ``location`` property if you require an absolute point instead.

get · iOS 17.5+

azimuth

TypeScript
get azimuth(): _SwiftUICore_Angle
Swift declaration
let azimuth: Angle

A value that represents the azimuth angle of a hovering Apple Pencil. This value is `.zero` when the Apple Pencil points along the view’s positive x-axis.

get · iOS 17.5+

altitude

TypeScript
get altitude(): _SwiftUICore_Angle
Swift declaration
let altitude: Angle

A value that represents the altitude angle of the hovering Apple Pencil. This value is `.zero` when the Apple Pencil is parallel to the view’s surface, and is 90 degrees (π/2 radians) when the Apple Pencil is perpendicular to the view’s surface.

get · iOS 17.5+

location

TypeScript
get location(): { x: number; y: number }
Swift declaration
let location: CGPoint

The location of an Apple Pencil hovering in the area above the view’s bounds, expressed as a point in that view’s coordinate space. Use the ``anchor`` property if you require a normalized anchor point for use with a presentation modifier instead.

get · iOS 17.5+

zDistance

TypeScript
get zDistance(): number
Swift declaration
let zDistance: CGFloat

The normalized distance between the screen and a hovering Apple Pencil. This value is `1` at the maximum distance from the screen and approaches `0` as the Apple Pencil gets closer to the screen.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUI types →