Instance Method


Retrieves all shortcuts added to Siri for your app.


func getAllVoiceShortcuts(completion completionHandler: @escaping ([INVoiceShortcut]?, Error?) -> Void)



The block invoked on a background thread after the system retrieves the list of shortcuts. This block has no return value and takes the following parameters:


An array of INVoiceShortcut objects. This parameter is nil when an error occurs.


An NSError object if a problem occurred retrieving the shortcuts; otherwise, nil.


Let users know when an action they perform in your app has an associated shortcut. For example, a user has created a shortcut in the soup-ordering app Soup Chef that allows them to place an order for tomato soup by speaking the phrase "Soup time." The app shows the phrase in the user's order history, reminding them that the shortcut exists and of the phrase to speak in order to invoke the shortcut in Siri.

Figure 1

Remind the user of an existing shortcut's invocation phrase

A screenshot of the order history screen in the Soup Chef app showing the invocation phrase for the shortcut.

The app uses the getAllVoiceShortcuts(completion:) method to retrieve the list of shortcuts associated to the app. The list contains shortcuts added to Siri with INUIAddVoiceShortcutViewController and those added by the user in the Settings app.

Listing 1

Retrieve shortcuts associated with the Soup Chef app

public func updateVoiceShortcuts(completion: (() -> Void)?) {
    INVoiceShortcutCenter.shared.getAllVoiceShortcuts { (voiceShortcutsFromCenter, error) in
        if let voiceShortcutsFromCenter = voiceShortcutsFromCenter {
            self.voiceShortcuts = voiceShortcutsFromCenter
        } else {
            if let error = error as NSError? {
                os_log("Failed to fetch voice shortcuts with error: %@", log: OSLog.default, type: .error, error)

        if let completion = completion {

See Also

Getting Shortcuts Added to Siri