A draft of SpeechManager.swift, that recognize the spoken text using Siri.
It use the Apple Speech framework (https://developer.apple.com/documentation/speech):
Perform speech recognition on live or prerecorded audio, receive transcriptions, alternative interpretations, and confidence levels of the results.
How to use
Import the SpeechManager.swift into your project and call it from your controller:
class ViewController: UIViewController { // the speech manager var speechManager: SpeechManager? override func viewDidLoad() { super.viewDidLoad() // init with language speechManager = SpeechManager(delegate: self, language: "it-IT") } } // SpeechManagerProtocol, called on text recognized extension ViewController: SpeechManagerProtocol { func didTextRecognized(text: String) { print( text ) } }
Full SpeechManager here:
Enjoy with Siri!
Latest posts by Alberto Pasca (see all)
- Swift – Simple full screen loader - 11 August 2022
- macOS – Disable microphone while typing - 11 April 2022
- iOS – Secure app sensitive information - 25 March 2022