CellProvider

Generic Cell Providers

Swift is great, but sometimes working with UIKit can be less safe than hanging off the edge of a cliff without a net.

My cell provider implementation ticks off the following:

Type-safe cell providers

Multiple cell types

I actually wrote this code a long time ago for another library of mine, Populate.

Populate also includes a more consistent API for dealing with data in your table/collection views. Including type-safety, NSFetchedResultsController-like bindings via a simple Swift array, value-types support, sectioning, sorting, and more.

Implementation

The key to implementing multiple type-safe cell handling, is the ResuableView and ReusableViewHosting protocol extensions. It automatically handles all the registration/dequeueing for you — and all without stringly typed identifiers.

Installation

This repo includes a simple sample project for your convenience, however in order to use the code, you simply need to copy CellProvider.swift into your project.