A Swift Package which helps to implement Speech to Text functionality in SwiftUI
Import the package through SPM using: https://github.com/pandashashwat97/SwiftUISpeechToText.git
Usage
Start by importing SwiftUISpeechToText
- import SwiftUISpeechToText
UPADTES FOR BEGINERS: After the above steps you can now directly create a state variable and call a predefined view with the latest update v1.0
You will get a text field with prdefined option to convert speech to text.
Create a StateObject
- @StateObject var speechRecognizer = SpeechRecognizer()
Start transcribing
- Call function: speechRecognizer.transcribe()
Stop transcribing
- Call function: speechRecognizer.stopTranscribing()
Converted Text
- Use speechRecognizer.transcript as the converted text string
For more details about implementation please import and checkout the below project: https://github.com/pandashashwat97/SwiftUISpeechToTextDemo
Final Implementation: