Get user context (current URL) for App Intent

When in Safari, you can say something like, "Siri, text this link to mom" or "Siri, save this link to reminders" and it will do it with the currently viewed link. Shortcuts also has a "Get what's on screen" action that can be added. How do I expose the user's current context to my App Intent?

Answered by DTS Engineer in 792087022

You don't need an app intent for this. Instead, you need to set up a NSUserActivity as mentioned in the Siri section of that link. To tell the system which activity is on screen, you set it using the userActivity modifier on a SwiftUI View, or the userActivity property of a UIViewController.

Accepted Answer

You don't need an app intent for this. Instead, you need to set up a NSUserActivity as mentioned in the Siri section of that link. To tell the system which activity is on screen, you set it using the userActivity modifier on a SwiftUI View, or the userActivity property of a UIViewController.

Get user context (current URL) for App Intent
 
 
Q