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)
- Unity3D – Snap object in editor grid - 3 January 2021
- Swift – UIView gradient extension - 7 December 2020
- iOS – Data Leakage: App background cache - 16 November 2020