UICollectionViewLayout from scratch
summary
Shows how a production-grade custom UICollectionViewLayout is implemented for VK Market: a single layout supports floating headers and section backgrounds, adaptive column counts for phones and tablets, decorative views, custom insert/delete animations and controlled scrolling to precise offsets. Demonstrates the pitfall of recomputing all frames (huge FPS drop) and the fix: prepare()-based caching and use of invalidation contexts plus prepareForCollectionViewUpdates/finalize to recompute only changed items, yielding smooth scrolling and working animations.
AI-written summary · about
chapters (25)
- 0:00Introduction
- 1:48What is UICollectionView
- 3:35Talk outline
- 4:17Why use Collection View
- 5:41Flow Layout limits
- 7:46Compositional Layout
- 9:31UICollectionViewLayout from scratch
- 12:58Simple layout creation
- 15:04Cell frame calculation
- 18:15Frames depend on content
- 20:29Performance issues
- 21:53prepare method role
- 23:20Section background
- 25:31Floating header
- 28:04Header animation issues
- 29:29UICollectionViewLayoutInvalidationContext
- 33:06Custom invalidation context
- 36:01Optimize attribute recalc
- 38:30Insert and delete items
- 41:02Prepare for update
- 42:44Finalize updates
- 43:48Scroll management
- 45:40Cell appearance animation
- 47:05Cell deletion animation
- 47:28Resources and materials








