スイッチがオンの場合、テキストから単語への音声が x 秒ごとに話されます。スイッチは最初のビュー コントローラー上にあり、音声は 2 番目のビュー コントローラーへのセグエの後に発生します。
最初のView Controllerのコード:
@IBAction func speakwords(sender: AnyObject) {
NSNotificationCenter.defaultCenter().postNotificationName("speaknotif", object: speakwords)
2 番目のビュー コントローラーのコード:
verride func viewDidLoad() {
NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("talk:"), name: "speaknotif", object: self.view.window)
func talk(notification: NSNotification){guard let count = notification.object else {return}
if Bool(TYPE_BOOL as! NSO) = "true"{
let speechsynth = AVSpeechSynthesizer()}