---
title: "forEachGesture"
description: "Repeatedly calls [block] to handle gestures. If there is a [CancellationException], it will wait
until all pointers are raised before another gesture is detected, or it exits if [isActive] is
`false`.

[awaitEachGesture] does the same thing without the possibility of missing events between
gestures, but also lacks the ability to call arbitrary suspending functions within [block]."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


> **Deprecated** Use awaitEachGesture instead. forEachGesture() can drop events between gestures.

```kotlin
suspend fun PointerInputScope.forEachGesture(block: suspend PointerInputScope.() -> Unit)
```


Repeatedly calls `block` to handle gestures. If there is a `CancellationException`, it will wait
until all pointers are raised before another gesture is detected, or it exits if `isActive` is
`false`.

`awaitEachGesture` does the same thing without the possibility of missing events between
gestures, but also lacks the ability to call arbitrary suspending functions within `block`.



