mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-23 17:28:22 +00:00
IGListCollectionContext typesafe method for dequeueReusableSupplementaryView(fromStoryboardOfKind:
Summary: add typesafe method for dequeueReusableSupplementaryView(fromStoryboardOfKind: Reviewed By: natestedman Differential Revision: D26238613 fbshipit-source-id: 15d18628fd54e2d7d0ff3cb0b1f88bb473bfbfed
This commit is contained in:
parent
dd3726343d
commit
6224a6536c
1 changed files with 29 additions and 0 deletions
|
|
@ -147,4 +147,33 @@ extension ListCollectionContext {
|
|||
|
||||
return supplementaryView
|
||||
}
|
||||
|
||||
/**
|
||||
Dequeues a supplementary view from the collection view reuse pool.
|
||||
|
||||
- Parameters:
|
||||
- elementKind: The kind of supplementary view.
|
||||
- identifier: The identifier of the supplementary view in storyboard.
|
||||
- sectionController: The section controller requesting this information.
|
||||
- index: The index of the supplementary view.
|
||||
|
||||
- Returns: A supplementary view dequeued from the reuse pool or a newly created one.
|
||||
*/
|
||||
public func dequeueReusableSupplementaryViewFromStoryboard<T: UICollectionReusableView>(
|
||||
ofKind elementKind: String,
|
||||
withIdentifier identifier: String,
|
||||
forSectionController sectionController: ListSectionController,
|
||||
atIndex index: Int
|
||||
) -> T {
|
||||
guard let supplementaryView = self.dequeueReusableSupplementaryView(
|
||||
fromStoryboardOfKind: elementKind,
|
||||
withIdentifier: identifier,
|
||||
for: sectionController,
|
||||
at: index
|
||||
) as? T else {
|
||||
fatalError()
|
||||
}
|
||||
|
||||
return supplementaryView
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue