Can you define things

Types of variables used in the Shortcuts app

The “Shortcuts” app offers the option of creating variables manually or having them created automatically.

Magic variables

In every shortcut the output of every action is automatically displayed as magic variable to disposal. Unlike manual variables, with magic variables you don't have to save the output of an action yourself for later use. Instead, just tap the "Magic Variable" button and select the output of any action to be used as a variable.

You can switch to a special view of the shortcut editor using the "Magic variable" button. In this view, the output of all actions of a shortcut can be seen in the form of selectable variables. In this way, an action can access the output of a previous action and use it as input. Magic variables are also beneficial from a visual point of view, as they reflect the symbol of the action from which they are each generated.

What adds to the “magical appeal” of these variables is the fact that the variable type can be changed: all you have to do is tap on a magic variable to change its format and specify the details to use. For more information, see Customizing Variables in the Shortcuts App.

In most cases, creating shortcuts can be made easier by using magic variables. In addition, the automatic creation of variables is preferable to the manual creation.

Manual variables

With the action "Set variable" or the action "Add to variable" you can add manual variables to a shortcut.

With the action "Set variable" you can create a new variable for the first use or overwrite a previously saved variable.

With "Add to variable" you can add several content elements to a specific variable. The elements are appended to the variable each time the shortcut is executed and the data is saved as an ordered list.

Setting variables manually tends to make shortcuts longer and harder to read. In many cases manual variables are unnecessary. Magic variables serve the same purpose, but do so much more precisely and compactly. For example, you can replicate much of the functionality of the “Add to Variable” action by embedding the variables in a “List” action and retrieving the variable at a later time.

For step-by-step instructions on adding variables to a shortcut, see Using Variables in the Shortcuts app.

Not all apps, services, and content are available in all countries, states, or regions.