Language SPM compatible

Integrate Speech framework and WaveformView(by jyunderwood)

Important!!! This project is currently pre-release. Some features or api interface may change frequently


Swift Package Manager

Note: Instructions below are for using SwiftPM without the Xcode UI. It’s the easiest to go to your Project Settings -> Swift Packages and add BSSpeechRecognizer from there.

To integrate using Apple’s Swift package manager, without Xcode integration, add the following as a dependency to your Package.swift:

.package(url: "", .upToNextMajor(from: "0.1.0"))


  • iOS 11
  • add the “Privacy – Speech Recognition Usage Description” key (NSSpeechRecognitionUsageDescription) to your app’s Info.plist file
  • add the “Privacy – Microphone Usage Description” key (NSMicrophoneUsageDescription) to your app’s Info.plist file


  • Initialize a BSSpeechRecognizer
    • resourceView should conform to BSSpeechDisplayView and will be use to handle the results of recognition
    • waveView should conform to BSSpeechWaveView and will be use to handle the changes of audio level (0~1)
      • There has a implemented waveView called BSWaveVisualizeView based on WaveformView-iOS by jyunderwood
    • errorView should conform to BSSpeechErrorView and will be use to handle the Errors
    • stateView should conform to BSSpeechStateView and will be use to handle the changes of recognizer available state

@IBOutlet weak var waveView: BSWaveVisualizeView!

let recognizer = BSSpeechRecognizer(
        presenter: BSSpeechRecognizeWaveViewPresenter(
            resourceView: self,
            waveView: waveView,
            errorView: self,
            stateView: self)

To Start recognize


System will ask Microphone and SpeechRecognition permissions when the first time start recoginzer.

Implement protocols


func display(_ viewModel: BSSpeechDisplayViewModel)

struct BSSpeechDisplayViewModel {
    var result: String
    var isFinal: Bool


func updateWithLevel(_ level: CGFloat)    
func display(_ viewModel: BSSpeechWaveViewModel)

struct BSSpeechWaveViewModel {
    var duration: TimeInterval
    var isShow: Bool


func display(_ viewModel: BSSpeechErrorViewModel)

struct BSSpeechErrorViewModel {
    let message: String?


func display(_ viewModel: BSSpeechStateViewModel)

struct BSSpeechStateViewModel {
    let isRecognizing: Bool


BSSpeechRecognizer is available under the MIT license. See the LICENSE file for more info.


View Github