Many apps that I download from the App Store seem to be adding shortcuts to the Shortcuts app, without me ever setting up a voice command. I was under the impression that to add a shortcut to the Shortcuts app, a user would need to create a voice command, via INUIAddVoiceShortcutViewController, which would then add the shortcut to the Shortcuts app.
This is how I am currently adding a shortcut in my app, but am wondering how I could go about offering shortcuts in the Shortcuts app without needing to call INUIAddVoiceShortcutViewController?
This is how I am currently adding a shortcut in my app, but am wondering how I could go about offering shortcuts in the Shortcuts app without needing to call INUIAddVoiceShortcutViewController?
Code Block let activity = NSUserActivity(activityType: "com.example.shortcut") activity.title = "Sample Shortcut" activity.userInfo = ["speech" : "This is a sample."] activity.isEligibleForSearch = true activity.isEligibleForPrediction = true activity.persistentIdentifier = "com.example.shortcut.myshortcut" self.view.userActivity = activity activity.becomeCurrent() let siriShortcut = INShortcut(userActivity: activity) // Setup view controller let viewController = INUIAddVoiceShortcutViewController(shortcut: siriShortcut) // Setup modal style viewController.modalPresentationStyle = .formSheet // Setup delegate viewController.delegate = self // Show view controller DispatchQueue.main.async { self.present(viewController, animated: true, completion: nil) }