- 1.How to create a grid layout in a UICollectionView
- 2.How to switch from one layout to another in UICollectionView
- 3.Create a custom datasource for your UICollectionView
- 4.Pass objects between viewcontrollers in Swift
- 5.Create custom layout with multiple UICollectionViewCells
- 6.Upload image to Firebase Storage in iOS using Swift
- 7.Create the login view and manage user state – Create an iOS app from an UI Kit in Swift
I’ve made that mistake a ton of times that I created one giant viewController and put everything there. This is obviously not a good way to write software, but at that time I had no idea that this bas a bad idea.
Instead of that, you should create your own datasource objects.
Datasource not equals to a sub-viewcontroller
A datasource object should be an object that is responsible for managing your data objects, dealing with inserts, deletes, updates and even downloads.
You should create it in a way that it is easy to adopt it later on. A true datasource object should also grab some protocol/delegate methods of UICollectionView and UITableViews such as cellForItem or numberOfItemsInSection.
In the video below I show you an easy way that you can get your viewController lighter and separate the methods that doesn’t really belong to there.
See how to create a custom datasource for your UICollectionView