SFSpeechAudioBufferRecognitionRequest cannot be re-used

Found a possible answer so decided to share. Others may find it useful. This was added into the function recordAndRecognizeSpeech().

Error was obvious, but the solution not so for us learning. App not crashing. If a better answer exists - hopefully someone else can help.

// This resets the recognitionRequest so "...cannot be re-use..." error is avoided. 
recognitionRequest = SFSpeechAudioBufferRecognitionRequest()   // recreates recognitionRequest object.
guard let recognitionRequest = recognitionRequest else { fatalError("Unable to created a SFSpeechAudioBufferRecognitionRequest object") }

Tags:

Swift