How to add Siri Shortcuts Actions (SiriKit Intents) to an App?

Viewed 618

I'm working on building my first app, and I need to add Siri Shortcuts actions (SiriKit Intents) to it, I honestly am not able to find any reliable resources online which are up-to-date with the latest version of Xcode, I found one by the developer of ToolBox Pro for Shortcuts, but I'm facing a few issues following along in the part two. Do any of you all know any good resources for learning how to integrate Shortcuts actions into SwiftUI apps? (SwiftUI)

2 Answers

Documentation can be found here to add a custom SiriKit Intent Definition File to your project. They give you examples of defining intent parameters.

Then use the modifier onContinueUserActivity in SwiftUI. More documentation available here. That's pretty much all you need to add Siri Shortcuts to your SwiftUI project, exactly how I accomplished this in my SwiftUI app.

.onContinueUserActivity(_ activityType: String, perform action: @escaping (NSUserActivity) -> ())

To add Siri shortcut intents go to File > New > New File > Sirikit Intent Defination File

Related