I have a filterbar, which is a UIView as well as a tableView in my controller like so:
override func viewWillLayoutSubviews() {
    sortSalonsByDistanceAndReload()
}    
func setupViews() {
    view.addSubview(filterBar)
    view.addSubview(tableView)
    filterBar.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
    filterBar.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
    filterBar.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
    filterBarHeightLC = filterBar.heightAnchor.constraint(equalToConstant: 44)
    filterBarHeightLC?.isActive = true
    tableView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
    tableView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
    tableView.topAnchor.constraint(equalTo: filterBar.bottomAnchor).isActive = true
    tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
}
I want to make the filterBar dissapear when the user scrolls down on the tableView, and then reappear when the user scrolls up
 
     
     
    