I hope someone can help as I have worked on this problem for hours. I have an array of phrases. I want to get the app to speak 7 of the phrases starting at the point the user chooses. This works for one phrase but will not work when I change the position in the array to a variable varied by a For loop.
import UIKit
import AVFoundation
class view_ViewController: UIViewController {
var numSubject = 0
var noteArray = writeString.components(separatedBy: “#”)
var speakIt = AVSpeechUtterance(string: "Fred")
IBAction func subButtonOne(_ sender: Any) {
speakIt = AVSpeechUtterance(string: noteArray[numSubject + 1])
speakIt.rate = 0.5
synth.speak(speakIt) }
any thoughts?