iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics
Guille Gonzalez

This is a really nice idea! I’m using it now, but there’s a small change required so that all your concrete cell subclasses don’t have to implement the protocol explicitly.

extension ReusableView where Self: UIView {

static var defaultReuseIdentifier: String {

// Lowercase `self` is important! Using `Self` always returns `”UICollectionViewCell”` or `”UITableViewCell”`.

return String(self)