.background 방식
Button {
let utterance = AVSpeechUtterance(string: word.alphabet ?? "")
utterance.voice = AVSpeechSynthesisVoice(language: "en-US")
DoctorSLApp.avSpeechSynthesizer.speak(utterance)
} label: {
Image(systemName: "speaker.wave.3")
.foregroundColor(.accentColor)
.frame(width: 50, height: 50, alignment: .center)
.background(.ultraThinMaterial, in: Circle())
}
.clipShape 방식
Button {
let utterance = AVSpeechUtterance(string: word.alphabet ?? "")
utterance.voice = AVSpeechSynthesisVoice(language: "en-US")
DoctorSLApp.avSpeechSynthesizer.speak(utterance)
} label: {
Image(systemName: "speaker.wave.3")
.foregroundColor(.accentColor)
.frame(width: 50, height: 50, alignment: .center)
.background(.red)
.clipShape(RoundedRectangle(cornerRadius: 10))
}
728x90
반응형