From 212f1ba80d991ebc5872de31003aaa8d7b6ad6fa Mon Sep 17 00:00:00 2001 From: GokulVenkat Date: Tue, 3 Dec 2024 17:53:29 +0530 Subject: [PATCH] Show cancel button in searchBar in BookMarks --- DuckDuckGo/BookmarksViewController.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/DuckDuckGo/BookmarksViewController.swift b/DuckDuckGo/BookmarksViewController.swift index 235afcd895..1d9055769c 100644 --- a/DuckDuckGo/BookmarksViewController.swift +++ b/DuckDuckGo/BookmarksViewController.swift @@ -1009,8 +1009,18 @@ extension BookmarksViewController: UISearchBarDelegate { } func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { + searchBar.setShowsCancelButton(false, animated: true) // Hide the Cancel button + searchBar.resignFirstResponder() finishSearching() } + + func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { + searchBar.setShowsCancelButton(true, animated: true) + } + + func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { + searchBar.setShowsCancelButton(false, animated: true) + } } extension BookmarksViewController: UISearchResultsUpdating {