diff --git a/Source/IGListKit/IGListCollectionContext.h b/Source/IGListKit/IGListCollectionContext.h index 9c64e78d..745434be 100644 --- a/Source/IGListKit/IGListCollectionContext.h +++ b/Source/IGListKit/IGListCollectionContext.h @@ -240,7 +240,7 @@ NS_SWIFT_NAME(ListCollectionContext) @return A supplementary view dequeued from the reuse pool or a newly created one. - @note This method uses a string representation of the view class as the identifier. + @note This method uses the nib name as the reuse identifier. */ - (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(NSString *)elementKind forSectionController:(IGListSectionController *)sectionController diff --git a/Source/IGListSwiftKit/IGListCollectionContext+Refinements.swift b/Source/IGListSwiftKit/IGListCollectionContext+Refinements.swift index 60716e08..1567c3d8 100644 --- a/Source/IGListSwiftKit/IGListCollectionContext+Refinements.swift +++ b/Source/IGListSwiftKit/IGListCollectionContext+Refinements.swift @@ -147,7 +147,7 @@ extension ListCollectionContext { return supplementaryView } - + /** Dequeues a supplementary view from the collection view reuse pool. @@ -173,7 +173,41 @@ extension ListCollectionContext { ) as? T else { fatalError() } - + + return supplementaryView + } + + /** + Dequeues a supplementary view from the collection view reuse pool. + + - Parameters: + - elementKind: The kind of supplementary view. + - sectionController: The section controller requesting this information. + - nibName: The name of the nib file. + - bundle: The bundle in which to search for the nib file. If `nil`, this method searches the main bundle. + - index: The index of the supplementary view. + + - Returns: A supplementary view dequeued from the reuse pool or a newly created one. + + - Note: This method uses the nib name as the reuse identifier. + */ + public func dequeueReusableSupplementaryView( + ofKind elementKind: String, + forSectionController sectionController: ListSectionController, + nibName: String, + bundle: Bundle?, + atIndex index: Int + ) -> T { + guard let supplementaryView = self.dequeueReusableSupplementaryView( + ofKind: elementKind, + for: sectionController, + nibName: nibName, + bundle: bundle, + at: index + ) as? T else { + fatalError() + } + return supplementaryView } }