Reputation: 287
I tried to import the SpeechKit framework for watchOS and received an error. Is there a way to use it with watch? I am getting an error when I import the Speechkit Framework saying "no such module Speech"
import WatchKit
import Foundation
import Speech
class SpeechInterfaceController: WKInterfaceController, SFSpeechRecognizerDelegate {
override func awake(withContext context: Any?) {
super.awake(withContext: context)
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
}
Upvotes: 5
Views: 735
Reputation: 1225
SpeechKit framework is not available for watchOS 3.
To get the speech recognition in a watch app you can instead use:
presentTextInputController(withSuggestions: nil, allowedInputMode: .plain) { (results) in
if let results = results?.first as? String {
self.label.setText(results)
}
}
Upvotes: 2
Reputation: 126167
The Speech framework is not in the watchOS SDK (as of watchOS 3.0-3.1, at least). You can see this in the framework docs:
(If it supported watchOS, tvOS, or macOS, those would be listed under SDK on that page.)
You can also see the set of available frameworks in your Xcode SDK: look at Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.1.sdk/System/Library/Frameworks/
, or at the jump bar atop the Xcode editor pane when you look at the ObjC version of a watchOS system header file, or the list of available options when you manually add to Linked Frameworks and Libraries for your project's WatchKit extension target.
Upvotes: 2