All the Things: Productivity Course  →  Learn More

How to make a workflow run from both the widget and the share sheet

Here at The Sweet Setup, we love using Workflow to improve our efficiency and showcase the power of iOS to tackle mundane, repetitive tasks. While the main way to view, edit, and run your workflows is within the Workflow app, it’s much quicker to run them from the widget or the action extension in the share sheet.

Using an “input check” method, you can set up one workflow to function from both the widget and the action extension.

Input Check

Sharing from another app using the action extension sends content as input into the workflow, whereas workflows run from the widget don’t have an input. Instead, you can create your own input point by using the clipboard. This way, you can copy something, open the widget, and run the workflow to accept the contents of the clipboard.

Instead of setting up two different workflows for each point of entry, you can also use an input check method that makes a single workflow more dynamic. With this, you use the Count and If actions to count whether there’s an input (1+ items) and, if so, use the Workflow Input coming from the action extension. Or, when there’s no input (0 items), it can use the Clipboard instead so you can run it from the widget as well.

How To

When you create a new workflow, select the Today Widget and Action Extension types.

Place the Count action and set it to Items. Then, get an If action, place it, and change the Input field to is Less Than and the Number field to 1. Under the first If section, place the Get Clipboard action. Under Otherwise, place Get Variable, tap Choose Variable → Select Magic Variable, and choose the green Workflow Input token.

Then, anywhere else in your workflow, you can use the If Result wherever you want your content to go.

Examples

This can be useful for saving links to services like Pocket, where you can share from apps that support the share sheet or copy a link from ones that don’t have a share sheet like Facebook and run the workflow from the widget instead.

This trick is also helpful for Music, Photos, and many other file types or content on your devices you might use with Workflow. For example, you could set up photo workflows that default to selecting a photo if there’s not an image coming from the share sheet.

In addition, when you want to tweet your music, count the result of Get Current Song to determine whether to use what’s already playing or select new music. Remember, you can check for inputs against any action, not just the Workflow Input.

If you come up with any great workflows that use an input check, let us know on Twitter.

Get the workflows:


We have more useful workflow examples right here.


Get Back Hours Per Week

Discover how to improve your workflows and get more focus with this free, in-depth guide to productivity.

Download Now »