mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-24 01:38:26 +00:00
IGListCollectionContext typesafe method for dequeueReusableCellFromStoryboard
Summary: add typesafe method for dequeueReusableCellFromStoryboard Reviewed By: natestedman Differential Revision: D26238579 fbshipit-source-id: 11e09b4487b2d64b1be53530358922e98b00cd33
This commit is contained in:
parent
7b26f4f32e
commit
f3abdcac0d
1 changed files with 26 additions and 0 deletions
|
|
@ -92,4 +92,30 @@ extension ListCollectionContext {
|
|||
|
||||
return cell
|
||||
}
|
||||
|
||||
/**
|
||||
Dequeues a storyboard prototype cell from the collection view reuse pool.
|
||||
|
||||
- Parameters:
|
||||
- identifier: The identifier of the cell prototype in storyboard.
|
||||
- sectionController: The section controller requesting this information.
|
||||
- index: The index of the cell.
|
||||
|
||||
- Returns: A cell dequeued from the reuse pool or a newly created one.
|
||||
*/
|
||||
public func dequeueReusableCellFromStoryboard<T: UICollectionViewCell>(
|
||||
withIdentifier reuseIdentifier: String,
|
||||
for sectionController: ListSectionController,
|
||||
at index: Int
|
||||
) -> T {
|
||||
guard let cell = self.dequeueReusableCellFromStoryboard(
|
||||
withIdentifier: reuseIdentifier,
|
||||
for: sectionController,
|
||||
at: index
|
||||
) as? T else {
|
||||
fatalError("A cell with the identifier \"\(reuseIdentifier)\" was not found in the storyboard")
|
||||
}
|
||||
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue