File size: 746 Bytes
d5ee97c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
//  ContentView.swift
//  TF TTS Demo
//
//  Created by 안창범 on 2021/03/16.
//

import SwiftUI

struct ContentView: View {
    @StateObject var tts = TTS()
    
    @State var text = "The Rhodes Must Fall campaigners said the announcement was hopeful, but warned they would remain cautious until the college had actually carried out the removal."
    
    var body: some View {
        VStack {
            TextEditor(text: $text)
            Button {
                tts.speak(string: text)
            } label: {
                Label("Speak", systemImage: "speaker.1")
            }
        }
        .padding()
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}