Created
February 2, 2019 04:34
-
-
Save myrickchow32/3273288604ea0a379ffb2277c2772508 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func getUtteranceWithDelay(preUtteranceDelayInSecond: Int, postUtteranceDelayInSecond: Int) -> AVSpeechUtterance { | |
| let utterance = AVSpeechUtterance(string: "Hello world") | |
| utterance.preUtteranceDelay = TimeInterval.init(exactly: preUtteranceDelayInSecond)! | |
| utterance.postUtteranceDelay = TimeInterval.init(exactly: postUtteranceDelayInSecond)! | |
| return utterance | |
| } | |
| let avSpeechSynthesizer = AVSpeechSynthesizer() | |
| avSpeechSynthesizer.speak(getUtteranceWithDelay(preUtteranceDelayInSecond: 1, postUtteranceDelayInSecond: 2)) | |
| avSpeechSynthesizer.speak(getUtteranceWithDelay(preUtteranceDelayInSecond: 1, postUtteranceDelayInSecond: 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment