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?

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