Throttling and Debouncing

I want to use Throttling and Debouncing to handle the inputs from the user. These are common techniques to reduce the number of events that are triggered by the inputs. I know how to implement them with the ObservableObject protocol and Combine framework. However, I am trying to migrate to the @Observable property wrapper, which is a new feature of SwiftUI. I cannot find a way to support Throttling and Debouncing with @Observable.

Does anyone have any ideas or suggestions on how to solve this problem?

Post not yet marked as solved Up vote post of Philip Mobil Down vote post of Philip Mobil
612 views

Replies

Much of the infrastructure that you might previously have got from Combine is available in Swift concurrency, but it’s not built in. Rather, you’ll find it in the Swift Async Algorithms package.

IMPORTANT This is still very much a work in progress. For the latest developments, and also if you want to get involved, see Swift Forums > Related Projects > Swift Async Algorithms.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"