         self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
         
         //filteredUser = userMessages
-        
+
     }
     
     

    var filteredUser = [UserMessages]()
    var isSearching = false

    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.hideKeyboard()
        

        return isSearching ? filteredUser.count: userMessages.count
    }
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    
//        let uid = FIRAuth.auth()!.currentUser!.uid
//        let ref = FIRDatabase.database().reference()
//        let key  = ref.child("users").childByAutoId().key
//        
//        let array = isSearching ? self.filteredUser : self.userMessages
//        
//        var isFollower = false
//        
//        ref.child("users").child(uid).child("following").queryOrderedByKey().observeSingleEvent(of: .value, with: { snapshot in
//            
//            if let following = snapshot.value as? [String : AnyObject] {
//                for (ke, value) in following {
//                    if value as! String == array[indexPath.row].uid {
//                        isFollower = true
//                        
//                        ref.child("users").child(uid).child("following/\(ke)").removeValue()
//                        ref.child("users").child(array[indexPath.row].uid!).child("followers/\(ke)").removeValue()
//                        
//                        self.tableview.cellForRow(at: indexPath)?.accessoryType = .none
//                    }
//                    //self.tableview.reloadData()
//                }
//            }
//            if !isFollower {
//                let following = ["following/\(key)" : array[indexPath.row].uid]
//                print("following: \(following)")
//                let followers = ["followers/\(key)" : uid]
//                
//                ref.child("users").child(uid).updateChildValues(following)
//                ref.child("users").child(array[indexPath.row].uid!).updateChildValues(followers)
//                
//                self.tableview.cellForRow(at: indexPath)?.accessoryType = .checkmark
//            }
//            
//        })
//        ref.removeAllObservers()
//        tableview.deselectRow(at: indexPath, animated: true)
//       //self.tableview.reloadData()
        
    }
    
