setRelevantShortcuts(_:completionHandler:)

setRelevantShortcuts(_:completionHandler:)

setRelevantShortcuts(_:completionHandler:) Instance Method of INRelevantShortcutStore Sets the relevant shortcuts.

func setRelevantShortcuts(_ shortcuts: [INRelevantShortcut], completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
func setRelevantShortcuts(_ shortcuts: [INRelevantShortcut]) async throws

Parameters

  • shortcuts: A list of relevant shortcuts.
  • completionHandler: The block invoked on a background thread after the system stores the relevant shortcuts. This block has no return value and takes the following parameter:
  • error

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

Discussion

Call this method to give Siri the list of relevant shortcuts for your app. To replace the list, call the method again, passing in a new list of relevant shortcuts. If you want to remove all relevant shortcuts associated with your app, call the method passing in an empty array.

To ensure the system stores the relevant shortcuts, wait for the system to call the completionHandler block.