Apologies
You must be signed in to watch this lesson.
Favorites 2 Column Grid UICollectionView Controller
Podcasts
We've now successfully implemented the searching and playing of the podcasts in our app. Everything looks great so far, however you'll notice that every time we restart our application we have to search for our favorite podcasts every time. It would be nice to implement some way to easily save the podcasts we want to listen to upon opening our app. In this lesson, we'll implement the view controller that will reveal all of our favorited podcasts. Let's first start with stubbing out a UICollectionViewController that will show some dummy data.

Comments (4)
gottaminute
5 years ago
Hi Brian, I'm getting this crash error and not sure of the proper way to fix it... UICollectionView received layout attributes for a cell with an index path that does not exist: It happens when I scroll up and down on the collectionView. Here is my code... func setupViewControllers() { let layout = UICollectionViewFlowLayout() //let layoutTwo = UIViewController() let newController = NewController(collectionViewLayout: layout) let popController = PopularController(collectionViewLayout: layout) // let aboutController = AboutController(collectionViewLayout: layoutTwo) viewControllers = [ generateNavigationController(with: newController, title: "New Images", image: image(resourceName: "new")), generateNavigationController(with: popController, title: "Popular Images", image: image(resourceName: "popular")), generateNavigationController(with: AboutController(), title: "About", image: image(resourceName: "about")) ] } I'm using two (collectionViewLayout: layout) for two different screens. Do you happen to know what is causing this error? Seems like the two collectionViews are getting confused with each other, but not sure :\ Thanks for any help!!
gottaminute
5 years ago
Hi, I changed the code to this... func setupViewControllers() { let layoutNew = UICollectionViewFlowLayout() let layoutPop = UICollectionViewFlowLayout() //let layoutTwo = UIViewController() let newController = NewController(collectionViewLayout: layoutNew) let popController = PopularController(collectionViewLayout: layoutPop) // let aboutController = AboutController(collectionViewLayout: layoutTwo) viewControllers = [ generateNavigationController(with: newController, title: "New Images", image: #imageLiteral(resourceName: "new")), generateNavigationController(with: popController, title: "Popular Images", image: #imageLiteral(resourceName: "popular")), generateNavigationController(with: AboutController(), title: "About", image: #imageLiteral(resourceName: "about")) ] } So far no errors, but does that look like the correct fix? I separated the UICollectionViewFlowLayouts to have a unique name for each.
Brian Voong
5 years ago
forsuresh
5 years ago
If you increased the width of cell so there is only one per row, it looks like we have a tableViewController. Is this something we should do in the future whenever a tableViewController is needed just so we can have more options for the future in our apps?
Brian Voong
5 years ago
mdoor1123
5 years ago
Hey Brian - incredible course and am really happy with supporting the training courses and looking forward to continuing to support in the future. One note, in your description of this episode (Favorites 2 Column Grid UICollectionView Controller) you write, "Everything looks great so far, however you'll notice that everything we restart our application...: I'm pretty sure you mean "every time" rather than "every thing ". Again, just a minor misspelling, this course is incredible as are the other courses I've taken from you here and on YouTube. Thanks again, Mike
Brian Voong
5 years ago
novan
5 years ago
Hi Brian, Incredible course, I wonder how to make every section have dynamic height ? (base on items) Thanks Noor
HELP & SUPPORT