From d636c162b2afbc000915404252518b98fef69319 Mon Sep 17 00:00:00 2001 From: Mustafa Ibrahim Date: Fri, 28 Oct 2016 17:23:34 +0200 Subject: [PATCH] -- fixes --- Source/MICountryPicker.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/MICountryPicker.swift b/Source/MICountryPicker.swift index 93829c4..1c97473 100644 --- a/Source/MICountryPicker.swift +++ b/Source/MICountryPicker.swift @@ -155,14 +155,14 @@ open class MICountryPicker: UITableViewController { extension MICountryPicker { override open func numberOfSections(in tableView: UITableView) -> Int { - if searchController.searchBar.isFirstResponder { + if searchController.searchBar.text!.characters.count > 0 { return 1 } return sections.count } override open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - if searchController.searchBar.isFirstResponder { + if searchController.searchBar.text!.characters.count > 0 { return filteredList.count } return sections[section].countries.count @@ -179,7 +179,7 @@ extension MICountryPicker { let cell: UITableViewCell! = tempCell 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]