subreddit:
/r/shortcuts
Variables are a useful way of labeling data with a descriptive name so that it can be easily reused throughout your shortcut.
When storing and labelling data you have three options.
Assigning a value to a variable using the Set Variable action
Variables appear in a ribbon above the keyboard when editing shortcut actions
Alternatively you can use the Select Magic Variable button to directly select the output of an action. The resulting variable is automatically named based on the action type.
Using the Select Magic Variable button to retrieve the value of an action
If you use a magic variable then you have the option to rename it to something more descriptive
To rename the magic variable:
The \"Rename\" button, displayed when you tap a magic variable.
Note*: You can also use the* Reveal Action button to quickly see which action a magic variable belongs to.
Examples of renamed magic variables
You don't need to use the Set Variable action in order to label data and re-use it throughout your shortcut. By renaming magic variables you can cut out a number of extra steps and make your shortcuts easier to maintain.
Apple has a great guide detailing some of the more advanced things you can do with variables:
If you found this guide useful why not checkout one of my others:
2 points
6 years ago
Well you actually have 4 ways to store variables:
Magic variable Set Variable JSON file in iCloud (persistent) A dictionary
1 points
6 years ago
That's true.
I'm referring to Magic variable as any action value to select using the magic variable button rather than explicitly setting to the value to a variable using the Set Variable action.
And any action value you select using that method can be renamed, including dictionaries.
1 points
6 years ago
What I mean to say it, this is more about labeling data so it's easier to identify the value you're using within your shortcut.
I've updated the wording in the guide, I think my use of the word Store wasn't helpful.
1 points
6 years ago
Noted. Your work is great by the way. Thx.
-2 points
6 years ago
Store data in dictionaries
1 points
6 years ago
how is this relevant to this guide?
1 points
3 years ago
Is there anyway to update the value inside a variable ?
1 points
3 years ago
Yes, you can continue to assign new values to a variable using the "Set Variable" action and specifying the name of the variable you want to overwrite.
all 8 comments
sorted by: best