๐ A lightweight Swift package for speech recognition and synthesis on iOS.
Built for modern Swift apps, tested with Swift Testing, and ready for SwiftUI.
- โ
SpeechRecognizer
โ handles speech-to-text with configurable language support and UI callbacks - โ
SpeechSynthesizer
โ speaks text aloud with adjustable pitch, rate, and language - โ Child-friendly defaults for storytelling apps
- โ
Modern
@Observable
state management (no delegates!) - โ Safe fallback behavior and clear error reporting
- โ Fully documented with DocC-style comments
- โ
Tested using Swift's native
import Testing
framework
Use Swift Package Manager to add the library:
.package(url: "https://github.com/michaelborgmann/SpeechKit.git", from: "0.1.0")
Then import it in your code:
import SpeechKit
let recognizer = SpeechRecognizer()
recognizer.language = Locale(identifier: "en-US")
recognizer.onTranscriptUpdate = { print("Partial: \($0)") }
recognizer.onStop = { print("Final result: \($0 ?? "")") }
recognizer.startRecording()
// ...
recognizer.stopRecording()
let speaker = SpeechSynthesizer()
speaker.language = "pt-PT"
speaker.pitch = 1.2
speaker.speak(text: "Olรก! Bem-vindo ao nosso app.")
- iOS 17+ (due to
@Observable
macro support) - Swift 5.9 or Swift 6
- Swift Concurrency-compatible
- Swift Package Manager (SPM)
MIT License โ see LICENSE
Please credit this project if you use it in commercial or open-source apps.
Created by Michael Borgmann for the Wonder Tales storytelling engine. Part of the Vicentina Studios toolchain for creative, language-rich experiences.