Contents

onAppear(perform:)

Adds an action to perform before this content appears.

Declaration

nonisolated func onAppear(perform action: (() -> Void)? = nil) -> some CompositorContent

Parameters

  • action:

    The action to perform. If action is nil, the call has no effect.

Return Value

A CompositorContent that triggers action before it appears.

Discussion

The exact moment that SwiftUI calls this method depends on the specific content type that you apply it to, but the action closure completes before the first rendered frame appears.