Skip to content

Commit 1f6d97f

Browse files
Guihal GwennGuihal Gwenn
authored andcommitted
add bundle var on CollectionCellDescribable to enable using collor in external frameworks
1 parent e01385d commit 1f6d97f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Collor/Classes/CollectionCellDescribable.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public protocol CollectionCellDescribable : Identifiable {
2020
var selectable: Bool { get }
2121
func getAdapter() -> CollectionAdapter
2222
func size(_ collectionView: UICollectionView, sectionDescriptor: CollectionSectionDescribable) -> CGSize
23+
var bundle: Bundle { get }
2324
}
2425

2526
extension CollectionCellDescribable {
@@ -32,3 +33,10 @@ extension CollectionCellDescribable {
3233
}
3334
}
3435
}
36+
37+
public extension CollectionCellDescribable {
38+
var bundle: Bundle {
39+
let typeClass = type(of: self)
40+
return Bundle(for: typeClass)
41+
}
42+
}

Collor/Classes/CollectionDataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class CollectionDataSource: NSObject, UICollectionViewDataSource {
3737
let cellDescriptor = collectionData.sections[indexPath.section].cells[indexPath.item]
3838

3939
if collectionData.registeredCells.contains(cellDescriptor.identifier) == false {
40-
let nib = UINib(nibName: cellDescriptor.className, bundle: nil)
40+
let nib = UINib(nibName: cellDescriptor.className, bundle: cellDescriptor.bundle)
4141
collectionView.register(nib, forCellWithReuseIdentifier: cellDescriptor.identifier)
4242
collectionData.registeredCells.insert(cellDescriptor.identifier)
4343
}

0 commit comments

Comments
 (0)