Create quick interactions with Shortcuts on watchOS
Shortcuts are a natural fit on Apple Watch, allowing people to get things done with just a tap — even from a complication. Bring your app's intents to the wrist: We'll help you optimize your shortcuts performance, understand how intents can be routed from watchOS to iOS, explore the latest interaction and presentation interfaces, and examine how the Shortcuts app manages shortcuts and intents for Apple Watch.
Hi everyone. My name is Conrad and welcome to my crib. I'm very excited to tell you today about the new Shortcuts experience in watchOS 7.
First, I'm going to introduce you to the all new Shortcuts app on Apple Watch.
Then, my colleague Alex will walk you through what you can do as a developer to craft a delightful Shortcut's experience and watchOS. Last year on watchOS 6, wou brought some exciting new updates to Shortcuts in Siri.
We added the ability for Shortcuts to have parameters, which means that Siri can ask follow up questions. You can see here that Siri is asking which items to add my Walmart cart. You can also run Shortcuts right from the Siri watch face. Shortcuts are suggested on the face when they become relevant and you can run them with a tap at just the right moment. This year I'm really excited to share with you all the new Shortcuts app on watchOS 7.
The Shortcuts app on watchOS, naturally compliments its iOS counterpart and you can run Shortcuts with a single tap right from your wrist. The Shortcuts that you know and love on iOS work just as well in Shortcuts on watchOS. For example, here is a great shortcut from the Shortcuts gallery that automatically texts someone an ETA of how long it will take to get home, running right on the watch. In the new Shortcuts app, you can organize and edit your Apple watch collection to determine which Shortcuts should sync Via iCloud to your watch. If a shortcut asks a question, you can answer those questions in line inside of the Shortcuts app. For example, here I am prompted to choose which event I want to get directions to in my directions to event shortcut.
We're also very excited to support complications for the New Shortcuts app on watchOS. You can see here that I can launch the Shortcuts app in just a single tap straight from the watch face. But that's not all, you can also set up complications that launch a specific shortcut directly.
You can see here that I can send my ETA right from my watch face. I just tap on the complication, tap run, and there's my message. That message looks good, so I'll go ahead and send it. By supporting Shortcuts inside of your app, your app Shortcuts could also be available right from the watch face.
Now I'm going to hand it over to my colleague, Alex who will explain how you can build an awesome experience for Shortcuts on watchOS 7s. Alex...
Thanks, Conrad. Hi everyone.
Let's start with a quick recap about how you can offer Shortcuts in your apps, so that you can take full advantage of this great new Shortcuts experience on the watchOS. Just like on iOS, your apps can support Shortcuts by using the API's from the SiriKit's Suite of frameworks and the NSUserActivity API. If you're new to Shortcuts or Siri, you should start with watching these great sessions from the previous year's conferences.
Now, let's talk about her running Shortcuts on the watch is different from running them on iOS devices. As you may know, Shortcuts are seamless sync'd across all of your devices via iCloud. This means that people can configure Shortcuts on an iOS device, put some Shortcuts in the Apple Watch collection, and will expect to run those Shortcuts on their Apple Watch. So, what happens when someone runs a Shortcut on their watch? The flow will be different depending on how the Shortcut is implemented.
For Shortcuts you offer via the NSUserActivity API, we'll need to open the app to handle the activity. But we Cannot open the app if it's not Installed on the watch and in that case attempting to run such Shortcut would result in an error. Let's now take a look at intent based Shortcuts. Now, intents are handled by intents extensions. If an intent extension is installed on the watch, but it supports this intent, we'll just hand intent over to that.
If not, well we'll try to run this intent remotely on the paired phone.
We call this remote execution. Note how this is in contrast to an NSUserActivity based Shortcuts, which can only be run directly on the watch. But if the intent extension on the phone tells us that it needs to continue in the app, then just like for user activity based circuits, we won't be able to open the app remotely on the phone and an error will be shown.
Otherwise, the shortcut is executed remotely, on the phone. And here's what the overall decision process for running Shortcuts on the watch looks like.
You should design your Shortcuts to avoid this error notes, to ensure that people using your apps have a great experience on the watch and we'll go over how you can do that further in this session. And now, let's take a closer look at a remote execution and see what it means for you and the people who use their Shortcuts. If an intent is supported natively on the watch, we'll launch the associated watchOS intents extension and let It handle the intent. Similarly, user activity based Shortcuts will be opened In their corresponding watchOS app, if it is installed. If, on the other hand, we have to send the intent over to the paired phone, we introduce an additional hop for sending the data to the phone, which inevitably increases the overall time it takes to perform the task. As you can see, even if you don't have a watch app yet or you are not supporting all of the intents in your watchOS intents extension, we will still run the Shortcuts based on your intent. But, it will be slower than running locally. Best experience is achieved when the intent can be handled directly on the watch. Now that we've seen how running Shortcuts on watches is different from iOS, let's take a look at what your options are when supporting Shortcuts on the watch. The best approach by far is to have a watch bias app and have that app supported the same user activities Or intents that you support in iOS app. This will ensure the best showcase experience on the watch.
And if you don't offer a watch app yet, consider building one. If, for some reason, a watchOS us up is not an option for you, you can instead ensure that your Shortcuts work well with remote execution. Now, while remote execution is great for running Shortcuts for those of you who don't offer a watch app yet, your Shortcuts need to satisfy A few requirements in order to work well with it. First, remote execution is only supported for intents based Shortcuts, not an NSUserActivity based ones. This is because user activity based Shortcuts to require the app to be open in order to run, and opening an app on another device would be a very jarring experience. And second, only those intents that can perform the task entirely in background, without opening the app, can be executed remotely. This means that you need to not return continue in app in your intent handling code. Additionally, you would need to check the support spectrum execution checkbox in the suggestion section of the Xcode intent editor for all parameter combinations that you're using in your interaction donations. Let's now go over some of the best practices for implementing Shortcuts. As I mentioned earlier, there are two ways to support Shortcuts in your app. The first, is through the NSUserActivity API. And the second is using the Intents framework. And for all new Shortcuts adopters, we recommend to implement Shortcuts using intents because it provides a richer and much more flexible API and allows you to offer Shortcuts that support parameters and can run in background.
Another very important part is to make sure to compile your intents extension not only for iOS, but also for watchOS. This usually means creating a separate intents extension target in your Xcode project and bundling that extension with your watchOS app. As we've talked about previously, the best experience is achieved when the Shortcuts can run locally on the watch and don't need to rely on a remote execution. And for that you really want to strive to support as many intents in your watchOS intents extension as you can. Ideally on a watchOS, you should support all of the intents that you support on iOS. As you may know, the great thing about Shortcuts is that any Shortcut that you see in the Shortcuts app can also be run in Siri with your voice. And on watch, it is especially important to provide carefully constructed dialogs in your intents because intents UI extensions are not supported on a watchOS. Here's an example of a Siri confirmation UI for an internet based ordering Shortcut that is using the default information prompts. This is what you would see if you return in default intent response with code ready from your confirm method. But, it doesn't provide a lot of information beyond the fact that you're about to order soup.
In contrast to the previous example, here we use a custom confirm response and provide the person ordering the soup with it order total before they make the purchase. But, customer responses are very flexible and you can provide any additional information in our dialogs that you think can be relevant or helpful. So people using your shortcut in Siri. For more information on how to make your showcase work great in Siri, please refer to these past year's sessions. Another great spot to showcase your app on the watch is the Siri Watch Face. You should see whether the Shortcuts that Your app supports can be relevant in various circumstances and offer them on the Siri watch face. And to do that you can use the relevant Shortcut API from the intents framework. To learn more watch the Siri Shortcuts On the Siri Watch Face session from WWDC 2018. Let's recap what we've covered today. First, to make Shortcuts work on watchOS, you should either build a watch app or develop your Shortcuts to work with the remote execution.
Second, if you're just starting to adopt Shortcuts in your apps prefer to implement them using the richer intents API. Next, don't forget to compile your intent extension for watchOS and to bundle it with your watch app.
You should also construct your dialogs carefully to ensure a great voice experience for your Shortcuts when people run them in Siri. And finally, consider offering your Shortcuts on the Siri watch face.
Looking for something specific? Enter a topic above and jump straight to the good stuff.
An error occurred when submitting your query. Please check your Internet connection and try again.