From 25f454d1cfb06bf73e4dfcd4e87c7683b7bd8a99 Mon Sep 17 00:00:00 2001 From: Sugam Pandey Date: Thu, 6 Jul 2017 19:24:26 -0600 Subject: [PATCH] When Search bar is presented, the Done button should not invoke delegate's callback --- Pods/EPContactsPicker.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Pods/EPContactsPicker.swift b/Pods/EPContactsPicker.swift index d4d333b..3d1ade2 100644 --- a/Pods/EPContactsPicker.swift +++ b/Pods/EPContactsPicker.swift @@ -49,6 +49,8 @@ open class EPContactsPicker: UITableViewController, UISearchResultsUpdating, UIS var subtitleCellValue = SubtitleCellValue.phoneNumber var multiSelectEnabled: Bool = false //Default is single selection contact + var isPresentingSearch: Bool = false + // MARK: - Lifecycle Methods override open func viewDidLoad() { @@ -334,7 +336,11 @@ open class EPContactsPicker: UITableViewController, UISearchResultsUpdating, UIS func onTouchDoneButton() { dismiss(animated: true, completion: { - self.contactDelegate?.epContactPicker(self, didSelectMultipleContacts: self.selectedContacts) + if self.isPresentingSearch { + self.isPresentingSearch = false + } else { + self.contactDelegate?.epContactPicker(self, didSelectMultipleContacts: self.selectedContacts) + } }) } @@ -373,4 +379,8 @@ open class EPContactsPicker: UITableViewController, UISearchResultsUpdating, UIS }) } + open func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { + self.isPresentingSearch = true + } + }