What thread does .onDisappear run on?

Generated on 10/16/2024

1 search

The .onDisappear modifier in SwiftUI runs on the main thread. This is because SwiftUI views are designed to operate on the main actor, which is the main thread. This is consistent with the behavior of many UI frameworks that guarantee callbacks on the main thread, as discussed in the session Migrate your app to Swift 6.