Strongly typed collection cells vol. 2

Photo by Wesson Wang / Unsplash

Let's continue the work we did in the previous post by making UITableView and UICollectionView handle cells without hassle. Elevating Reusable protocol, write extension:

From now on, UITableView will use the Reusable protocol to handle cells reusing and registering. The same can be done to collection view:

To make sure everything works as expected, the XIB file for your cell should have the same name as the cell's class name. This will ensure registering by Nib works as expected!

If you like my idea, you can find the whole code as SPM, Cocoapod, and Carthage available here.

Artur Gruchała

Artur Gruchała

I started learning iOS development when Swift was introduced. Since then I've tried Xamarin, Flutter, and React Native. Nothing is better than native code:)