I want to use SiriKit to start my workout. To start a workout, you must open the main application from the application extension.
The template that Apple provides for the handler INStartWorkoutIntentHandling,
func handle(startWorkout startWorkoutIntent: INStartWorkoutIntent, completion: (INStartWorkoutIntentResponse) -> Void) {
let userActivity = NSUserActivity(activityType: NSStringFromClass(INStartWorkoutIntent))
let response = INStartWorkoutIntentResponse(code: .success, userActivity: userActivity)
completion(response)
}
How do I open my application? Something like myapp://workout?action=start&name=pushups This answer does not seem relevant, since I do not have extensions for this type of UIViewControllerproperty extensionContext.
Last bit: for other actions (pause, end), Id prefers not to open the main application, but simply to pause the workout performed in the main application. I could use a similar custom URL to pause it, but this will open the application, which is an unnecessary unnecessary step. Any good way to tell the main application to take a specific action from INExtension without opening the application?
source
share