     func searchBarSearchButtonClicked(searchBar: UISearchBar) {
 
         hideKeyboard()
+    }
+
+    func searchBar(searchBar: UISearchBar, textDidChange searchText: String) {
+
+        updateSearchResultsWithText(searchText)
+    }
+
+    private func updateSearchResultsWithText(searchText: String) {
+
+        let predicate = NSPredicate(format: "nickname CONTAINS[c] %@ OR username CONTAINS[c] %@", searchText, searchText)
+        let filteredFriends = friends.filter(predicate)
+        self.filteredFriends = filteredFriends
+
+        updateResultsTableView(scrollsToTop: !filteredFriends.isEmpty)
     }
 }
 


import UIKit
import KeyboardMan

class SearchConversationsViewController: UIViewController {



        switch section {
        case .Friend:
            return filteredFriends?.count ?? 0
        case .MessageRecord:
            return 2
        case .Feed:
