GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

CoreSpotlight and SwiftUI 2 - Deep linking with .onContinueUserActivity possible?

Forums > SwiftUI

Dear all,

I was following the implementation guidance of Spotlight of the Ultimate Portfolio App and tried to add search with Spotlight to my app as well.

I want to selected an item on Spotlight, navigate to the right detail view and perform an action based on the CSSearchableItemActionType.

However with .onContinueUserActivity I'm only able to perform this step by step, which means the following:

  1. I selected the Item in CoreSpotlight
  2. I get to the right TabView
  3. I selected the Item in CoreSpotlight again
  4. I get to the right DetailView of the TabView
  5. I selected the Item in CoreSpotlight again
  6. The right action gets performed on for the DetailView

This works but I want to perform all those steps with the first click on the Item on Spotlight (if I change back to a different TabView after Step 4 and select the Item in Spotlight again, I start with the first step again).

Each view has a .onContinueUserActivity: the initial AppView to get to the right TabView, the TabView to get to the right detail view, and the detail view to perform an action. I don't use any NavigationLinks in the respective Views.

  • Is there any possbility to chain all .onContinueUserActivity togehter, so they get performed in order once the user clicks on an Item in spotlight?
  • Or is a another approach needed to achieve something like this?

Any help is greatly appreaciated!

Cheers tobsens

3      

Hacking with Swift is sponsored by Alex.

SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!

Try for free!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.