Skip to content

Commit

Permalink
Support empty suggestionsList
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeBoisney committed Mar 7, 2017
1 parent 8022851 commit 7b6de9d
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions Pod/Classes/ModernSearchBar.swift
Expand Up @@ -296,13 +296,24 @@ public class ModernSearchBar: UISearchBar, UISearchBarDelegate, UITableViewDataS
// SUGGESTIONS VIEW UTILS
// --------------------------------

private func haveToOpenSuggestionView() -> Bool {
switch self.choice {
case .normal:
return !self.suggestionListFiltred.isEmpty
case .withUrl:
return !self.suggestionListWithUrlFiltred.isEmpty
}
}

private func openSuggestionsView(){
if (!self.isSuggestionsViewOpened){
self.animationOpening()

self.addViewToParent(view: self.suggestionsShadow)
self.addViewToParent(view: self.suggestionsView)
self.isSuggestionsViewOpened = true
if (self.haveToOpenSuggestionView()){
if (!self.isSuggestionsViewOpened){
self.animationOpening()

self.addViewToParent(view: self.suggestionsShadow)
self.addViewToParent(view: self.suggestionsView)
self.isSuggestionsViewOpened = true
}
}
}

Expand Down

0 comments on commit 7b6de9d

Please sign in to comment.