Swiftpack.co -  iOSDigital/STTLibrary as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A quick and easy way to leverage SFSpeechRecognizer
.package(url: "https://github.com/iOSDigital/STTLibrary.git", from: "1.1.1")



A simple Swift package wrapper for SFSpeechRecognizer. Returns a string.


Using Swift Package Manager, in Xcode:

File > Swift Packages > Add Package Dependency


Or manually

Just drop SSTLibrary.swift into your project.


  • Swift 5
  • iOS 13+
  • macOS 10.15+
  • Untested on tvOS, might work!


Firstly, before you do anything, add the Microphone and Speech privacy entries into your app's info.plist, otherwise it will hard crash!

<string>Need speech</string>
<string>Need microphone</string>

Then, once you have imported the module:

import SSTLibrary

Create a global instance of the Shared Instance:

let sstManager = SSTLibrary.shared

On say, a button press, start the recognizing process:

sstManager.startRecognizing { (result) in
    switch result {
        case .success(let string):
            // This is your speech to text result!

        case .failure(let error):
            // Something went wrong :(
            print("Error: \(error)")

The completion block above will be called once you call stopRecognizing, say when you press another button:



STTLibrary is licensed under the MIT License.


Stars: 1
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API