Introduction to Siri Shortcuts
Introduction to Siri Shortcuts
WWDC 2018
Creating Shortcuts
- Define (What you want expose)
- Donate (Tell the system every time the user does something)
- Handle
Shortcut APIs
NSUserActivity
Intents
File → New file → SiriKit Intent Definition File
Code generation (Automatically)
Donate
Handle
Handle your shortcut in the Background
INRelevantShortcut
Expose Shortcuts to the Siri Watch Face
How is a Shortcut Suggested?
Custom Intents
- Use enums (clearly bounded)
- Custom” results in an INObject
- Combines an identifier with a display string
- Identifier can reference an internal object
- Display string conveys that object to the user
- Prevents possible implicit dependencies between parameters
Shortcut Display
(title, subtitle, image)
- Understandable
- Represent what will happen
Shortcut Testing
Deleting Donations
Play Media Intent
- INPlayMediaIntent (new)