Chatroom Filter Delegate
Twitter Slide Out Menu
Let's get right back into action with a bonus lesson today. In this video, I'll walk you through how to setup a delegate on our UISearchBar that lets us gain access to events such as text changes. Next we look at how to perform a simple filter on the chatroom groups we set up in a previous lesson. Finally, our results in ChatroomMenuController need to reflect these newly filtered results so we'll fix that as well. Enjoy.

Comments (5)
rehannali
4 years ago
Hi Brain! I think the video is not available. It says the embed code is not valid.
Brian Voong
4 years ago
rehannali
4 years ago
I've off topic question. I have 3 base controller i.e ViewController, TableViewController and CollectionViewController. I've got a lot of duplication of code which I removed to make UIViewController extension because eventually all controller are inherited from it. Now problem is i'm using some completion blocks in some of my functions and as you know we can't use store properties in extension. I want to know how i can use completion block through extension or some other method which is better than this.
Brian Voong
4 years ago
Dennisvm82
4 years ago
I really like the map functionality in Swift. It gives you so much control over an array with only two lines of code. Usually testing everything on my device, so I've added the following two functions to remove the keyboard and constant focus on the search bar. func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { searchBar.showsCancelButton = true } func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { searchBar.text = "" searchBar.showsCancelButton = false searchBar.endEditing(true) filteredResults = chatroomGroups tableView.reloadData() }
Brian Voong
4 years ago
Mo Tiv
4 years ago
horizontal collectionview cell 0 != side menu pangesture :(
Brian Voong
4 years ago
Mo Tiv
4 years ago
hey brian, its something im trying to figure out. one of the viewcontrollers (lets say the discover view) has a collectionview of two pages with horizontal swiping. this disables the pangesture to swipe out the menu. if pangesture is added to the collectionview then the collectionview page swipe is disabled. adding gesture to cell doesnt seem to work either. if you can point me in the right direction that would be of great help. thanks.
Brian Voong
4 years ago
Mo Tiv
4 years ago
twitter has this feature in their third tab(notifications tab i believe). the menu slides out only on the first first page else if on the second page it comes back to the first. i will check out lesson 8 and let you know.
Mo Tiv
4 years ago
Followed your video again. Works like a charm. You are the best. Thanks a lot!
st4n
4 years ago
<3 :)
Brian Voong
4 years ago
st4n
4 years ago
it turned out to be simpler than I thought, I would never think about using the map function :) but (there is alway a but :] ) how to make the logic universal / reusable? With no hardcoded sections names in viewForHeaderInSection (not showing empty results section).. My first thought is to set heightForHeaderInSection to 0 when array is empty, but (again ;]) is it proper / elegant?
Brian Voong
4 years ago
HELP & SUPPORT