Post

Replies

Boosts

Views

Activity

Reply to iOS 16, AVFoundation, Text-to-Speech
Try declaring struct SUINightMode: View {   @ObservedObject var dtd = DateTimeData()   @Environment(\.presentationMode) var presentationMode   @State private var date = Date()   let synthesizer = AVSpeechSynthesizer() <---------     var body: some View {       ZStack { ... ... ...       Image(systemName: "speaker.wave.3.fill")           .resizable()           .foregroundColor(.green)           .frame(width: 50, height: 30)           .padding(10)           .position(x: 120, y: 40)           .onTapGesture {            let speakTime = AVSpeechUtterance(string: "The time is, \(dtd.timeString(date: dtd.date))...., today is \(dtd.dayString(date: dtd.date)) \(dtd.dateString(date: dtd.date))")            synthesizer.speak(speakTime) ... ... } } } } It helped me.
Nov ’22