Skip to content

Commit d7c810f

Browse files
committed
Refractored files. Added reload(_ item:) and reload(_ items:) functions.
1 parent 093b137 commit d7c810f

9 files changed

+25
-1
lines changed

SPDiffable.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = 'SPDiffable'
4-
s.version = '1.6.4'
4+
s.version = '1.6.5'
55
s.summary = 'Extenshion of Diffable API which allow not duplicate code and use less models.'
66
s.homepage = 'https://github.com/ivanvorobei/SPDiffable'
77
s.source = { :git => 'https://github.com/ivanvorobei/SPDiffable.git', :tag => s.version }

Sources/SPDiffable/DataSource/SPDiffableTableDataSource.swift Sources/SPDiffable/Table/SPDiffableTableDataSource.swift

+24
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,30 @@ open class SPDiffableTableDataSource: UITableViewDiffableDataSource<SPDiffableSe
111111
}
112112
}
113113

114+
/**
115+
SPDiffable: Reload one cell by item.
116+
117+
- parameter item: Reloading item.
118+
*/
119+
public func reload(_ item: SPDiffableItem) {
120+
reload([item])
121+
}
122+
123+
/**
124+
SPDiffable: Reload cells by items.
125+
126+
- parameter items: Reloading items.
127+
*/
128+
public func reload(_ items: [SPDiffableItem]) {
129+
var snapshot = self.snapshot()
130+
if #available(iOS 15.0, *) {
131+
snapshot.reconfigureItems(items)
132+
apply(snapshot)
133+
} else {
134+
snapshot.reloadItems(items)
135+
}
136+
}
137+
114138
// MARK: - Get Content
115139

116140
/**

0 commit comments

Comments
 (0)