Everything about iOS app development
Create A Custom Datasource For Your Uicollectionview In Ios

Create a custom datasource for your UICollectionView

Post Series: Create an iOS app

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