From 0c17a4b8ba4dda064fe6959363746d5b3771045a Mon Sep 17 00:00:00 2001 From: Mustafa Ibrahim Date: Fri, 28 Oct 2016 17:16:54 +0200 Subject: [PATCH] Fixes (Wrong selection from filtered result #12) --- Source/MICountryPicker.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/MICountryPicker.swift b/Source/MICountryPicker.swift index 1f63c51..93829c4 100644 --- a/Source/MICountryPicker.swift +++ b/Source/MICountryPicker.swift @@ -223,7 +223,7 @@ extension MICountryPicker { override open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) let country: MICountry! - if searchController.searchBar.isFirstResponder { + if searchController.searchBar.text!.characters.count > 0 { country = filteredList[(indexPath as NSIndexPath).row] } else { country = sections[(indexPath as NSIndexPath).section].countries[(indexPath as NSIndexPath).row]