Article

Getting High-Fidelity Input with Coalesced Touches

Learn how to support high-precision touches in your app.

Overview

UIKit usually delivers touches to your app at around 60 Hz, but some devices are capable of recording touch information at up to 240 Hz. On such devices, UIKit does not deliver the extra touch information automatically, in case the app does not need the extra data. Instead, it coalesces any extra touches into a single UITouch object, whose location reflects only the last recorded touch. However, apps that want the extra precision can retrieve and use the additional touch information.

Figure 1 illustrates what happens when the user drags Apple Pencil across the device. At the point where UIKit reports a touch event to the app, Apple Pencil has reported four touch positions, but UIKit reports only the last touch to the app by default. The remaining three touches are delivered as coalesced touches, and the app must retrieve them explicitly to use them.

Figure 1

Coalesced touches

An illustration, with two iPad screens shown side by side. On the left, the initial touch event made by Apple Pencil is shown toward the upper-left of the display. As Apple Pencil is dragged down and to the right, the touches are coalesced when the drag ends, as shown on the right.

To retrieve coalesced touches, call the coalescedTouchesForTouch: method of the UIEvent object containing the original UITouch object. That method returns the array of all touches since the last event, including the last UITouch object actually delivered to the app. You must retrieve coalesced touches immediately when handling an event. After handling the event, there is no guarantee that any coalesced touches will remain available.

Topics

Example

Implementing Coalesced Touch Support in an App

Learn how to create a simple app that handles coalesced touches.

See Also

Advanced Touch Handling

Implementing a Multi-Touch App

Learn how to create a simple app that handles multitouch input.

Minimizing Latency with Predicted Touches

Create a smooth and responsive drawing experience using UIKit's predictions for touch locations.