In my Apple Watch app I need to input text, so is there any way to input text in my app with voiceOver or any other ways?
As I have seen none of the objects in WKInterfaceController support editable text inputs like UITextfield or UITextview.
The above answer has no code, just a link to Apple's awesome XD documentation. You can launch a speech recognition menu with some voice options using this code (WatchOS2, iOS 9.2.1):
//LAUNCH VOICE DICTATION (physical device only)
func launchVoiceDictationMenu(){
self.presentTextInputControllerWithSuggestions(["Hello","Goodbye","Hey"], allowedInputMode: WKTextInputMode.Plain,
completion:{(results) -> Void in
let aResult = results?[0] as? String
print(aResult)
})
}
Update with swift 3 watchOS 3 Scribble mode
presentTextInputController(withSuggestions: ["watchOS3"], allowedInputMode: WKTextInputMode.plain) { (arr: [Any]?) in
print(arr ?? "Not find")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With