swift-sdk
swift-sdk copied to clipboard
RecognizeCallback has internal initializer in TextToSpeechV1
Example and test code says to use TextToSpeech.recognizeMicrophone thus:
let speechToText = SpeechToText(
username: GordyAppSettings.sharedInstance.speechToTextUsername,
password: GordyAppSettings.sharedInstance.speechToTextPassword)
var callback = RecognizeCallback()
callback.onResults = { results in
// handle successful results here
}
callback.onError = { error in
// handle error here
}
speechToText.recognizeMicrophone(settings: settings, callback: callback)
But RecognizeCallback has an internal initializer:
/**
* Copyright IBM Corporation 2019
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
public struct RecognizeCallback {
/// Invoked when transcription results are received for a recognition request.
public var onResults: ((SpeechRecognitionResults) -> Void)?
/// Invoked when an error or warning occurs.
public var onError: ((WatsonError) -> Void)?
}
Adding an empty public initializer to RecognizeCallback.swift fixes the issue.
@dokun1
I've submitted #960 to fix this.