From the course: iOS 10 App Development: Integrating SiriKit

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Workouts domain

Workouts domain

From the course: iOS 10 App Development: Integrating SiriKit

Start my 1-month free trial

Workouts domain

- [Instructor] Now we'll look at handling a startWorkout intent. I've set up everything in my plist files here and here and I have my ViewController that says which workout I started, AppDelegate which gets the information from the userActivity and sends it to the ViewController and we'll head over to IntentHandler.swift. So in here again we just need to handle the handle method so I have that set up and I'm setting the workoutName and the userInfo property of the user activity right here and the one thing that I want to point out if you're doing a workout is that I found that I was getting an empty userInfo dictionary when using this, and the reason why is because I was passing an intent.workoutName. If I go down here and I start to type out intent and a .workoutName, it is an INSpeakableString which is not a string object. So I was treating it like it was a string and Swift does not make that conversion when it puts it inside of a dictionary and it ends up emptying out the…

Contents