onDisappear(perform:)
Adds an action to perform after this content disappears.
Declaration
nonisolated func onDisappear(perform action: (() -> Void)? = nil) -> some CompositorContent
Parameters
- action:
The action to perform. If
actionisnil, the call has no effect.
Return Value
A CompositorContent that triggers action after it disappears.
Discussion
The exact moment that SwiftUI calls this method depends on the specific content type that you apply it to, but the action closure doesn’t execute until the content disappears from the interface.