Skip to content

Instantly share code, notes, and snippets.

@bsmith11
Last active March 7, 2017 15:42
Show Gist options
  • Save bsmith11/30616d2aa33d169c54311d7c5783f32f to your computer and use it in GitHub Desktop.
Save bsmith11/30616d2aa33d169c54311d7c5783f32f to your computer and use it in GitHub Desktop.
DataSource snippet
public typealias ReloadBlock = ([IndexPath]) -> Void
public protocol DataSource {
associatedtype ModelType
var reloadBlock: ReloadBlock? { get set }
var numberOfSections: Int { get }
func numberOfItems(in section: Int) -> Int
func item(at indexPath: IndexPath) -> ModelType?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment