explaingit

soysaucelab/collectionkit

4,513SwiftAudience · developerComplexity · 2/5Setup · easy

TLDR

Swift library for iOS that replaces UICollectionView with a simpler Provider pattern for building scrollable lists and grids, with automatic diff-based updates and composable multi-section layouts.

Mindmap

mindmap
  root((CollectionKit))
    What it does
      Scrollable lists and grids
      Auto diff updates
      Composable sections
    Provider pattern
      Data source
      View source
      Size source
    Built-in layouts
      Flow layout
      Waterfall layout
      Row layout
    Audience
      iOS developers
      Swift developers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a scrollable photo grid or content feed in an iOS app with automatic animated updates when data changes.

USE CASE 2

Create a multi-section scrollable view where each section has its own data, layout, and cell sizing rules.

USE CASE 3

Replace verbose UICollectionView delegate and data source boilerplate with a three-object Provider setup in Swift.

USE CASE 4

Implement a waterfall layout or horizontal scrolling row with a few lines of Swift using built-in layout objects.

Tech stack

SwiftiOS

Getting it running

Difficulty · easy Time to first run · 30min

Install via CocoaPods or Carthage, targets iOS 8 and Swift 3 or later, so Xcode version compatibility is worth checking.

In plain English

CollectionKit is a Swift library for iOS developers who build scrollable lists and grids of content inside their apps. iOS has a built-in component for this called UICollectionView, but developers often find it verbose and difficult to work with. CollectionKit offers a replacement that is designed to be simpler to set up, more composable, and better performing. The core idea is a Provider pattern. Instead of implementing several delegate and data source methods scattered across a class, you describe your collection by assembling three objects: a data source that holds your items, a view source that describes how each item should appear on screen, and a size source that tells the layout how large each cell should be. You hand this bundle to the CollectionKit view, and it handles the rest. When your data changes, the framework automatically figures out what was added, removed, or moved, and updates only those parts of the screen. Layout is handled by separate Layout objects that you can swap in or modify. The built-in options include a flow layout (items arranged left to right then wrapping to the next line), a waterfall layout (variable-height columns like a photo grid), and a row layout. Layouts can be transposed from vertical to horizontal or padded with insets by chaining modifier calls. One of the more practical features is composition. You can take multiple independent providers, each with its own data, layout, and sizing rules, and combine them into a single scrollable view with separate sections. Updating one section does not require touching the others. The framework batches rapid data changes together so the screen only redraws once per layout cycle, which keeps scrolling smooth. CollectionKit is installed through CocoaPods or Carthage. It requires iOS 8 and Swift 3 or later. The README is written for iOS developers and assumes familiarity with Swift and Xcode.

Copy-paste prompts

Prompt 1
Show me how to set up a basic CollectionKit view in Swift with a data source, view source, and flow layout.
Prompt 2
How do I create a multi-section scrollable view in CollectionKit where each section uses a different layout?
Prompt 3
How does CollectionKit handle data updates automatically, and what does the diff animation look like in a real app?
Prompt 4
How do I switch from a vertical flow layout to a horizontal row layout in CollectionKit with minimal code changes?
Open on GitHub → Explain another repo

← soysaucelab on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.