Cody Weaver Cody Weaver - 7 months ago 80
Swift Question

iOS Audio Video custom messages

I am trying to play a custom message to a User on iOS. Just a simple message that will say "Hello World" is all I am wondering. Is there a way to pass a string to

and have the system play that? Also, I am looking for an answer in Swift is possible.


AVSpeechSynthesizer can do that:

import UIKit
import AVFoundation

class ViewController: UIViewController {
    let speechSynthesizer = AVSpeechSynthesizer()

    override func viewDidLoad() {

        speechSynthesizer.speakUtterance(AVSpeechUtterance(string: "Hello World!"))