© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
P. FrieseAsynchronous Programming with SwiftUI and Combinehttps://doi.org/10.1007/978-1-4842-8572-5_13

13. Combine Schedulers and SwiftUI

Peter Friese1  
Hamburg, Germany

By default, any code that you run in response to a UI event in SwiftUI will run on the main thread. Since a lot of our code deals with updating other UI elements in response to some user interaction, this is fine in most cases. For example, you might want to validate the user’s input to make sure they filled out all required fields of a multistep form. This is a memory-bound process that runs fast enough to be executed on the main thread without causing any issues.

However, once you want ...

Get Asynchronous Programming with SwiftUI and Combine: Functional Programming to Build UIs on Apple Platforms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.