I have a collection view with like 7-8 different cells. Cells are constructed in XIB files. Then in View Controller I use:
[self.collectionView registerNib:[UINib nibWithNibName:name bundle:nil] forCellWithReuseIdentifier:name];
Everything works as expected, but there are some performance issues. On the first scroll collection view noticeably lags as cells appear. After all kind of cells have been loaded at least once everything starts to scroll smoothly. Cells are not really complicated.
Q: Why do you even use XIBs for that, why not prototype cells in a storyboard?
A: Same cells are used in different collection views throughout the app. This way I can apply changes to a cell once in a xib. I couldn't come up with easier solution to do that.
I'm pretty sure UINib is cached after it's loaded and this is why it stops lagging. I was wondering if there's a way to preload those xibs at the splash screen for example. It will take a second or two, but will result in smoother experience.