Contents

onAppIntentExecution(_:perform:)

Registers a handler to invoke in response to the specified app intent that your app receives.

Declaration

nonisolated func onAppIntentExecution<I>(_ intent: I.Type = I.self, perform action: @escaping @MainActor (I) -> Void) -> some View where I : TargetContentProvidingIntent

Parameters

  • intent:

    The type of App Intent that the action closure handles.

  • action:

    A closure that SwiftUI calls when the specified app intent is being performed. The closure takes the app intent instance as an input parameter.

Return Value

A view that handles the specified app intent’s perform

Discussion

Use this view modifier to receive instances in a particular scene within your app. The scene that SwiftUI routes the incoming user activity to depends on the structure of your app, what scenes are active, and other configuration. For more information, see handlesExternalEvents(matching:).

If the app intent implements a perform() method, it will be called after the action closure. This can be useful if your app intent supports running in the background via the AppIntent.IntentModes API