Skip to content

Instantly share code, notes, and snippets.

@Bandd-k
Created November 2, 2018 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bandd-k/cf9ebb26296fa0092996eca2fb0aed4c to your computer and use it in GitHub Desktop.
Save Bandd-k/cf9ebb26296fa0092996eca2fb0aed4c to your computer and use it in GitHub Desktop.
struct Section<CellType: UICollectionViewCell, ModelType: AnyObject> {
var numberOfItems: Int { return elements.count }
var elements: [ModelType]
var identifier: String { return String(describing: type(of: ModelType.self)) }
var configurator: CollectionCellConfigurator<CellType, ModelType>
}
protocol Configurator {
var configureCell: (UICollectionViewCell, AnyObject) -> () { get set }
}
struct CollectionCellConfigurator<Cell: UICollectionViewCell, Item: AnyObject>: Configurator {
let configureCell: (Cell, Item) -> ()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment