Pierre Charpentier
Pierre Charpentier

Reputation: 270

WatchKit : presentTextInputControllerWithSuggestion slowed my app

I use a presentTextInputControllerWithSuggestion in my watch app in Swift. It works but my app is really slow after the dictation.

There is my code :

func dictation() {
        presentTextInputControllerWithSuggestions([], allowedInputMode: .Plain, completion: { (selectedAnswers) -> Void in
            if ((selectedAnswers != nil) && (selectedAnswers!.count>0) ){
                if selectedAnswers![0] is String {
                    self.label.setText((selectedAnswers![0] as! String))
                }
            }
        })
    }

I just display my text in a label. But, between the time where I press on "Done" in the dictation screen and the time where I can see my text, there is at leat a second.

I saw that is really quickly in Apple apps like Mail or Messages.

I saw that my watch CPU is near by 50% during the dictation and near 100% when I press "Done". My app doesn't consume CPU during this step. The CPU is consume by an other app (I suppose dictation).

Do you know how I can improve this response time ?

Upvotes: 0

Views: 99

Answers (0)

Related Questions