I am able to create a shortcut using NSUserActivity or Intent, and then let the user to record a certain phrase which will trigger certain shortcut, by presenting to him an appropriate view controller, or by sending hi to the Settings->Siri->Shortcuts. For this, I would use just this code for example:
let activityType = PageID.page1.rawValue
lazy var activity: NSUserActivity = {
let userActivity = NSUserActivity(activityType: activityType)
userActivity.title = "View Page"
userActivity.suggestedInvocationPhrase = "Page one"
userActivity.isEligibleForSearch = true
userActivity.isEligibleForPrediction = true
userActivity.persistentIdentifier = NSUserActivityPersistentIdentifier(activityType)
return userActivity
}()
This just add a shortcut to Siri's suggestions and it makes it available in Settings, but still a user has to record phrase to trigger a shortcut by a certain phrase.
How to predefine phrases like "Do some task" for a specific action and make possible for a user to use it, but without having a need of manually recording it?
More precisely, I want to open a specific page in my app, based on what user says. For example, Open page one, Open page two, Open Menu etc...