How to Use Dictionary Action in iOS 12 Shortcuts

The Dictionary action in iOS 12 Shortcuts allows you to store, organize, and retrieve structured data using key-value pairs within your automated workflows. This guide covers how to set up a dictionary, choose the correct data types, retrieve stored values using the "Get Dictionary Value" action, and apply these concepts to practical shortcut automations.

Understanding Dictionaries

A dictionary is a data container composed of "Keys" and "Values." A Key acts as an identifier or label (such as "Name" or "Email"), while the Value is the actual data associated with that label (such as "John" or "john@example.com"). Using dictionaries keeps complex shortcuts organized and eliminates the need for multiple separate variables.

Adding and Populating the Dictionary Action

  1. Open the Shortcuts app on iOS 12 and create a new shortcut or open an existing one.
  2. Search for the Dictionary action in the action search bar and add it to your shortcut workflow.
  3. Tap Add new item to create your first entry.
  4. Set the Key name by typing a label into the left-hand field.
  5. Tap the Type selector to define the data type. iOS 12 supports:
    • Text: For plain alphanumeric characters.
    • Number: For integers or decimal values.
    • Boolean: For True/False states.
    • Array: For an ordered list of items within a single key.
    • Dictionary: For nested dictionaries containing further key-value pairs.
  6. Enter the corresponding data into the Value field on the right. Repeat this process for any additional data fields you need.

Retrieving Values from the Dictionary

To read data out of your dictionary later in the shortcut:

  1. Search for and add the Get Dictionary Value action immediately after your Dictionary (or reference the Dictionary variable).
  2. Set the Get parameter to Value.
  3. In the Key field, type the exact name of the key you wish to retrieve (keys are case-sensitive).
  4. The output of this action will be the specific value associated with that key, which can now be passed into subsequent actions like Show Result, Send Message, or Open URL.

Using Nested Keys and Arrays

If you nest a dictionary inside another dictionary, you can extract deeply nested information by chaining multiple Get Dictionary Value actions.

  1. Use the first Get Dictionary Value action to fetch the child dictionary using the parent key.
  2. Place a second Get Dictionary Value action directly after it to extract the final value from the child key.

For arrays inside a dictionary, retrieve the array using Get Dictionary Value, then use the Get Item from List action to target specific items (such as the first item or a random item) from the list.