onContinueUserActivity
Registers a handler to invoke in response to a user activity that your app receives.
Declaration
compose().onContinueUserActivity(
activityType: string,
options: {
perform: (arg0: { activityType?: string; title?: string; webpageURL?: string; userInfo?: Record<string, unknown>; isEligibleForHandoff?: boolean; isEligibleForSearch?: boolean; isEligibleForPrediction?: boolean; }) => void;
}
)nonisolated func onContinueUserActivity(
_ activityType: String,
perform action: @escaping (NSUserActivity) -> ()
) -> some ViewParameters
activityType*stringThe type of activity that the
actionclosure handles. Be sure that this string matches one of the values that you list in the doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/NSUserActivityTypes array in your app's Information Property List.options.perform*(arg0: { activityType?: string; title?: string; webpageURL?: string; userInfo?: Record<string, unknown>; isEligibleForHandoff?: boolean; isEligibleForSearch?: boolean; isEligibleForPrediction?: boolean; }) => void
Return value
A view that handles incoming user activities.
Discussion
Use this view modifier to receive
doc://com.apple.documentation/documentation/Foundation/NSUserActivity
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 Scene.handlesExternalEvents(matching:).
UI frameworks traditionally pass Universal Links to your app using a
user activity. However, SwiftUI passes a Universal Link to your app
directly as a URL. To receive a Universal Link, use the
View.onOpenURL(perform:) modifier instead.
See also
More in Events and lifecycle.
- onAppearAdds an action to perform before this view appears.
- onChangeAdds a modifier for this view that fires an action when a specific value changes.
- onContinuousHoverAdds an action to perform when the pointer enters, moves within, and exits the view's bounds.
- onDisappearAdds an action to perform after this view disappears.
- onDragActivates this view as the source of a drag and drop operation.
- onDragSessionUpdatedSpecifies an action to perform on each update of an ongoing dragging operation activated by draggable(:) or anther drag modifiers.
- onDropDefines the destination of a drag and drop operation that handles the dropped content with a closure that you specify.
- onDropSessionUpdatedSpecifies an action to perform on each update of an ongoing drop operation activated by dropDestination(:) or other drop modifiers.
- onGeometryChangeAdds an action to be performed when a value, created from a geometry proxy, changes.
- onHingeChangeAdds an action to perform when the hinge context of the view hierarchy changes.
- onHoverAdds an action to perform when the user moves the pointer over or away from the view's frame.
- onInteractiveResizeChangeAdds an action to perform when the enclosing window is being interactively resized.