Using Siri Shortcuts

In iOS 12, Apple introduced Siri Shortcuts. Siri Shortcuts are a way to create shortcuts to your app for your users.  For example, let's say a user, every Tuesday, makes the same date night reservation with his wife at her favorite restaurant. Instead of having to go through all the steps each time, we can make this easier. Let's see how this works.

Open up your Info.plist file and add academy.cocoa.LetsEat.reservation-activity-type to NSUserActivityTypes. Make sure that you are in Info.plist for the app and not one of the other targets:

Now that we have our Info.plist set up, let's add some code. Open up the RestaurantDetailViewController.swift ...

Get iOS 12 Programming for Beginners - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.