Scripting in iOS: the Shortcuts app

Scripting is usually associated with computers, while using a smartphone has always been about interacting with apps. Smartphones don’t have as sophisticated a system shell as desktop systems. I won’t go into a discussion here about whether that’s good or bad. I just want to point to an interesting mechanism in iOS that allows for creating automations that connect different apps and parts of the system.

The “Shortcuts” App

This is where we create “shortcuts,” which are actually scripts, or sequences of steps that are executed when the shortcut is run.

In shortcuts, we can use basic logical operations, retrieve data from input or from the user, and call app actions.

We create shortcuts in a graphical interface, which of course differs from text-based code and takes some getting used to. There are a few differences and quirks that you simply need to learn.

Actions provided by iOS are quite diverse and sometimes surprisingly technical. In my opinion, the most interesting ones are:

A vast number of functions lie in the library of actions and triggers provided by individual applications. Unfortunately, we don’t have control over what we can do with a given app and in this matter, we are dependent on what the developer of that app has prepared for us. Fortunately, more and more applications are providing at least basic tools.

If you want to learn more about this system, one way to start is reading the official documentation.

Example

I write this blog in Notion. I keep all my blog post ideas in a Notion Database. Whenever I had a new idea for a post, I needed to go to the Notion app, open the correct page, click the “+” button and write down the idea. That was quite a few clicks. And a few seconds, too.

Now I have a shortcut for that. All the input is handled by the shortcut engine, so data input is smooth — the iOS takes care of it. When the data is ready, the shortcut inputs the item into the database specified in the shortcut.

Here is my “New Blog Idea” shortcut:

Example of a Shortcut