Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISearchBar iOS 13 voice dictation button

iOS 13 has voice dictation button in UISearchBar in all system applications, which duplicates mic button on system keyboard and shows dictation view:
enter image description here
But when I create new project in Xcode, add UISearchBar, and run application on device, it doesn't have mic button on UISearchBar.
Is there a way to make my application show that mic button on UISearchBar?

like image 875
Alexey Saechnikov Avatar asked Nov 16 '19 17:11

Alexey Saechnikov


1 Answers

There is a UISearchTextField instance in the UISearchBar. You can set the textField.rightView to a view of microphone. In the microphone button handler, you do the the speech-to-text recognition.

like image 133
Yao Fan Avatar answered Sep 17 '22 13:09

Yao Fan