Created
January 15, 2017 01:27
-
-
Save jayesh15111988/df00d391be391adc56a2aac3764dc7b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var searchTimer: Timer? | |
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { | |
if let searchTimer = searchTimer { | |
searchTimer.invalidate() | |
} | |
searchTimer = Timer.scheduledTimer(timeInterval: 0.4, target: self, selector: #selector(self.reload(timer:)), userInfo: searchText, repeats: false) | |
} | |
func reload(timer: Timer) { | |
print(timer.userInfo ?? "") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment