Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created July 27, 2018 17:23
Show Gist options
  • Save azamsharp/a3c23cb9c2a289b3cb1d4d6800594d9c to your computer and use it in GitHub Desktop.
Save azamsharp/a3c23cb9c2a289b3cb1d4d6800594d9c to your computer and use it in GitHub Desktop.
import Intents
class IntentHandler: INExtension, OrderCoffeeIntentHandling {
func confirm(intent: OrderCoffeeIntent, completion: @escaping (OrderCoffeeIntentResponse) -> Void) {
completion(OrderCoffeeIntentResponse(code: .ready, userActivity: nil))
}
func handle(intent: OrderCoffeeIntent, completion: @escaping (OrderCoffeeIntentResponse) -> Void) {
// place an order here
// if there are no errors in placing the order we will
// return success
completion(OrderCoffeeIntentResponse(code: .success, userActivity: nil))
}
override func handler(for intent: INIntent) -> Any {
// This is the default implementation. If you want different objects to handle different intents,
// you can override this and return the handler you want for that particular intent.
return self
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment