URL Scheme shortcuts://create-shortcut?name=YourShortcutName&url=YOUR_URL_ENCODED_CONTENT"

626 Views Asked by At

I am trying to find out how I can automatically create a shortcut like this. Of course the user interaction to save this shortcut is recommend.

if let createShortcutURL = URL(string: "shortcuts://create-shortcut?name=YourShortcutName&url=YOUR_URL_ENCODED_CONTENT") {
    UIApplication.shared.open(createShortcutURL, options: [:], completionHandler: nil)

It just opens the window in the shortcut app to create a new "shortcut".

Has anyone already had experience in this context?

1

There are 1 best solutions below

0
On

Currently, Apple has not documented programatic creation of a shortcut inside Shortcut.app using a shortcut:// URL

Looking at the documentation Open and create a shortcut using a URL scheme on iPhone or iPad - Apple Support

Open the URL shortcuts://create-shortcut to jump to the shortcut editor and to create a new shortcut.

Open a URL with the following structure: shortcuts://open-shortcut?name=[name], and provide the name of the shortcut in the name parameter.

The documentation does not show ?name= available for create-shortcut