Skip to content

Instantly share code, notes, and snippets.

View chrisscholly's full-sized avatar
🌎
Working remotely

Chris Scholly chrisscholly

🌎
Working remotely
View GitHub Profile
@chrisscholly
chrisscholly / ios-cell-registration-swift.md
Created March 13, 2017 16:17 — forked from gonzalezreal/ios-cell-registration-swift.md
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)