Instance Method

translation(in:)

The translation of the pan gesture in the coordinate system of the specified view.

Declaration

func translation(in view: UIView?) -> CGPoint

Parameters

view

The view in whose coordinate system the translation of the pan gesture should be computed. If you want to adjust a view's location to keep it under the user's finger, request the translation in that view's superview's coordinate system.

Return Value

A point identifying the new location of a view in the coordinate system of its designated superview.

Discussion

The x and y values report the total translation over time. They are not delta values from the last time that the translation was reported. Apply the translation value to the state of the view when the gesture is first recognized—do not concatenate the value each time the handler is called.

See Also

Tracking the Location and Velocity of the Gesture

func setTranslation(CGPoint, in: UIView?)

Sets the translation value in the coordinate system of the specified view.

func velocity(in: UIView?) -> CGPoint

The velocity of the pan gesture in the coordinate system of the specified view.