Instance Method


Returns the azimuth angle (in radians) of the stylus.


func azimuthAngle(in view: UIView?) -> CGFloat



The view that contains the stylus’s touch. Pass nil to get the azimuth angle that is relative to the touch’s window.

Return Value

The azimuth angle of the stylus, in radians.


In the plane of the screen, the azimuth angle is the direction in which the stylus is pointing. With the tip of the stylus touching the screen, the value of this property is 0 radians when the cap end of the stylus (that is, the end opposite of the tip) points along the positive x axis of the device's screen. The azimuth angle increases as the user swings the cap end of the stylus in a clockwise direction around the tip.

See Also

Getting Touch Attributes

var tapCount: Int

The number of times the finger was tapped for this given touch.

var timestamp: TimeInterval

The time when the touch occurred or when it was last mutated.

var type: UITouch.TouchType

The type of the touch.

enum UITouch.TouchType

The type of touch received.

var phase: UITouch.Phase

The phase of the touch.

enum UITouch.Phase

The phase of a finger touch.

var force: CGFloat

The force of the touch, where a value of 1.0 represents the force of an average touch (predetermined by the system, not user-specific).

var maximumPossibleForce: CGFloat

The maximum possible force for a touch.

var altitudeAngle: CGFloat

The altitude (in radians) of the stylus.

func azimuthUnitVector(in: UIView?) -> CGVector

Returns a unit vector that points in the direction of the azimuth of the stylus.