0

I am trying to implement an airlines app which will talkback in text and return miles for the users. I am using INSearchForAccountsIntentHandling protocol to implement it.

Like I want siri to reply saying "Your miles for the account no: 1000211 is 3000" in text on the screen of siri. I didnt find any documentation online on how to do it.

Firstly, is it even possible to do that ?

Secondly if it is, how can I implement it in my method below:

func handle(intent: INSearchForAccountsIntent, completion: @escaping (INSearchForAccountsIntentResponse) -> Void) { print("Sirikit is working") }

lifemoveson
  • 1,661
  • 8
  • 28
  • 55

1 Answers1

0

Based on what you're hoping to use this for, it seems you don't want SiriKit, but rather the use of AVSpeechSynthesizer. If you simply want your app to read back your sentence to the user the most basic implementation would look like this:

import AVFoundation

let synthesizer = AVSpeechSynthesizer()
let utterance = AVSpeechUtterance(string: "Your miles for the account no: 1000211 is 3000")
synthesizer.speak(utterance)

I think you'd need to adjust the way you're forming sentences to remove abbreviations, but as a concept this totally works.

Check out Apple's docs for much more info and details.

creeperspeak
  • 5,403
  • 1
  • 17
  • 38
  • Not exactly what I want. I think Siri cannot do talk back for what I am looking for. Thanks for the help though. – lifemoveson Feb 08 '18 at 02:08
  • But on that note, I want to do something like Robinhood which shows the UI if I ask the question to Siri which is totally a different question. – lifemoveson Feb 08 '18 at 02:14