Siri Shortcuts on Apple Watch

Learn how to take advantage of Siri and Shortcuts on the Apple Watch without any intervention required from the iOS companion app. By Mark Struzinski.

Leave a rating/review
Download materials
Save for later
Share
You are currently viewing page 4 of 4 of this article. Click here to view the first page.

Connecting the Handlers

Now, you have to invoke the shared handler from your intents extensions. In each extension, Xcode generated a file for you named IntentHandler.swift. Open each one and update the body of handler(for:) to the following:

return TrackIntakeIntentHandler()

The code above creates a new intent handler for any shortcut invoked from your app on iOS or watchOS.

Testing Your Intent

That was a lot of setup, but now you can test your intent in a shortcut!

Follow these steps to see your new intent in action:

  1. Select the Hydrator scheme. Build and run to your physical device.
  2. Open the Watch app on your phone and install the Hydrator app on the watch.
  3. Open the Shortcuts app on the phone.
  4. Tap + at the top of the screen to create a new shortcut.
  5. Next, tap Add Action.
  6. Then, tap Apps.
  7. Scroll down to find Hydrator and select it.
  8. Tap Track Intake.
  9. Tap Show More to expand options. You should see Ounces and Hydration Type appear.
  10. For each option, tap into the value and select Ask Each Time from the keyboard accessory view.
    Hydrate Me app Hydration type and amount entry
  11. Tap the ellipsis (⋯) button on the top right to open the shortcut’s settings.
  12. Name the shortcut Hydrate Me and ensure Show on Apple Watch is enabled.

Hydrate Me app add shortcut to Apple watch

  1. Tap Done to return to the shortcut, then tap Done again to save your shortcut.
  2. On your watch, open the Shortcuts app. You should see the Hydrate Me shortcut you just created near the top.

Hydrate Me app on Apple Watch Shortcut

  1. Tap to run it and answer the prompts.

Hydrate Me app Ounces Input

Hydrate Me app Drink List

Hydrate Me app Shortcut Success

Testing With Voice

Next, try running your shortcut solely by voice.

Hydrate Me app Amount of Intake Prompt

Hydrate Me app Drink List

Hydrate Me app Confirmation Message

  1. Push the digital crown to go back to the watch face.
  2. Hold in the crown or say “Hey, Siri” to invoke Siri.
  3. Say “Hydrate me”.
  4. Now, you should get voice prompts for both input items.

Validating Input

Now, open the Hydrator app on the watch. Tap refresh on the bottom right. You should see all the items you added via shortcuts now show up in the app!

Hydrate Me app Watch List

Adding Your App to the Watch Face

Finally, watchOS 7 adds the ability to put shortcuts directly on the watch face as a complication. Adding the Shortcuts complication to your watch face gives you the ability to select a specific shortcut to run when you tap that complication. Now your users have one-tap access to your shortcut!

Hydrate Me app on Watch Face

Where to Go From Here?

You can download the completed project files by clicking the Download Materials button at the top or bottom of the tutorial.

Shortcuts are an exciting and dynamic addition to Apple’s platforms. In this tutorial, you learned how to build shortcuts to run locally on the watch. You also learned to avoid remote execution by ensuring you build your intent extension for watchOS.

You can also investigate many related areas, including customization options for your flows, donating to the system, confirmation flows and more complicated disambiguation flows. Apple has released extensive documentation for SiriKit. We also have an excellent tutorial on SiriKit to help you take your shortcuts to the next level.

Take all these tools and see what kind of incredible experiences you can build for your users.

We hope you enjoyed this tutorial, and if you have any questions or comments, please join the forum discussion below!