Implementing shortcuts through NSUserActivity

The simplest way to implement Siri Shortcuts is to use NSUserActivity objects. An NSUserActivity object contains information about the current activity that a user is performing, and can be used to achieve several goals, one of which is to implement Siri Shortcuts. To find out about other uses of NSUserActivity, have a look at Chapter 21, Improved Discoverability with Spotlight and Universal Links.

Your app must register the identifiers, in the Info.plist file, for the user activity objects that it will handle. Add a new entry to the Info.plist for Hairdressers, and name it NSUserActivityTypes. The object type for this key should be an array. In this array, you should add the identifier for the ...

Get Mastering iOS 12 Programming - 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.