Skip to content

Commit dfe7346

Browse files
committed
Depreactes cellFactory in favor of configureCell.
1 parent aec86f0 commit dfe7346

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Example/Example2_RandomizedSectionsAnimation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ extension ViewController {
118118
}
119119

120120
func skinCollectionViewDataSource(dataSource: CollectionViewSectionedDataSource<NumberSection>) {
121-
dataSource.cellFactory = { (_, cv, ip, i) in
121+
dataSource.configureCell = { (_, cv, ip, i) in
122122
let cell = cv.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: ip) as! NumberCell
123123

124124
cell.value!.text = "\(i)"

Sources/DataSources/CollectionViewSectionedDataSource.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,30 @@ public class CollectionViewSectionedDataSource<S: SectionModelType>
104104
self._sectionModels = sections.map { SectionModelSnapshot(model: $0, items: $0.items) }
105105
}
106106

107-
public var cellFactory: CellFactory! = nil
107+
public var configureCell: CellFactory! = nil
108+
109+
@available(*, deprecated=0.8.1, renamed="configureCell")
110+
public var cellFactory: CellFactory! {
111+
get {
112+
return self.configureCell
113+
}
114+
set {
115+
self.configureCell = newValue
116+
}
117+
}
118+
108119
public var supplementaryViewFactory: SupplementaryViewFactory
109120

110121
public var moveItem: ((CollectionViewSectionedDataSource<S>, sourceIndexPath:NSIndexPath, destinationIndexPath:NSIndexPath) -> Void)?
111122
public var canMoveItemAtIndexPath: ((CollectionViewSectionedDataSource<S>, indexPath:NSIndexPath) -> Bool)?
112123

113124
public override init() {
114-
self.cellFactory = {_, _, _, _ in return (nil as UICollectionViewCell?)! }
125+
self.configureCell = {_, _, _, _ in return (nil as UICollectionViewCell?)! }
115126
self.supplementaryViewFactory = {_, _, _, _ in (nil as UICollectionReusableView?)! }
116127

117128
super.init()
118129

119-
self.cellFactory = { [weak self] _ in
130+
self.configureCell = { [weak self] _ in
120131
precondition(false, "There is a minor problem. `cellFactory` property on \(self!) was not set. Please set it manually, or use one of the `rx_bindTo` methods.")
121132

122133
return (nil as UICollectionViewCell!)!

0 commit comments

Comments
 (0)