Fix the search bar becoming first reponder issue in macOS

This commit is contained in:
Mingshen Sun 2023-03-14 21:15:16 -07:00
parent 4904b81da0
commit 6bc066dc73

View file

@ -112,9 +112,9 @@ class PasswordNavigationViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if searchText != nil {
if let text = searchText, !text.isEmpty {
DispatchQueue.main.async {
self.searchBar.text = self.searchText
self.searchBar.text = text
self.searchController.isActive = true
self.searchBar.becomeFirstResponder()
}