Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to input text in Apple Watch

Tags:

ios

watchkit

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.

like image 327
Abhishek Sinha Avatar asked Mar 18 '15 06:03

Abhishek Sinha


2 Answers

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)
        })
    }
like image 154
Josh Avatar answered Sep 30 '22 17:09

Josh


Update with swift 3 watchOS 3 Scribble mode

presentTextInputController(withSuggestions: ["watchOS3"], allowedInputMode:   WKTextInputMode.plain) { (arr: [Any]?) in
        print(arr ?? "Not find")
    }
like image 30
Raj Joshi Avatar answered Sep 30 '22 19:09

Raj Joshi