onContinueUserActivity(CSSearchableItemActionType, perform) does not work on a SwiftUI macOS app

onContinueUserActivity(CSSearchableItemActionType, perform) works as expected on iOS when we search and select an item from Spotlight, but nothing happens when we do the same on a SwiftUI macOS app.

var body: some Scene {
    WindowGroup {
        MyView()
            .onContinueUserActivity(CSSearchableItemActionType, perform: handleSpotlight)
    }
}



func handleSpotlight(_ userActivity: NSUserActivity) {
    // Is not called...
}

How can we respond to a user clicking a Spotlight result from our apps on macOS?

Spotlight is not supported on IOS17 or above and cannot be searched. How to solve this problem?

@marcosatanaka I'm observing the same issue, it works fine on iOS but that code is never called on macOS. Did you figure out a solution or it's simply broken?

I am also getting the same problem. i have a mac os app ie app content indexing and the perform block is never triggered. dont know what is causing the issue. Any help would be appreciated from DTS engineers.

onContinueUserActivity(CSSearchableItemActionType, perform) does not work on a SwiftUI macOS app
 
 
Q