Skip to content

Instantly share code, notes, and snippets.

@WildStudio
Created September 18, 2018 07:26
Show Gist options
  • Save WildStudio/38af120fe56b36ce0ff96c6310cf1524 to your computer and use it in GitHub Desktop.
Save WildStudio/38af120fe56b36ce0ff96c6310cf1524 to your computer and use it in GitHub Desktop.
// Once resolution is completed, perform validation on the intent and provide confirmation (optional).
func confirm(intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) {
// Verify user is authenticated and your app is ready to send a message.
let userActivity = NSUserActivity(activityType: NSStringFromClass(INSendMessageIntent.self))
let response = INSendMessageIntentResponse(code: .ready, userActivity: userActivity)
completion(response)
}
// Handle the completed intent (required).
func handle(intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) {
// Implement your application logic to send a message here.
let userActivity = NSUserActivity(activityType: NSStringFromClass(INSendMessageIntent.self))
let response = INSendMessageIntentResponse(code: .success, userActivity: userActivity)
completion(response)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment