Skip to content

Commit 92457de

Browse files
committed
Return to default system.
1 parent 6281032 commit 92457de

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

SPDiffable.podspec

Lines changed: 1 addition & 1 deletion
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.3.7'
4+
s.version = '1.3.8'
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/SPDiffableCollectionDataSource.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ open class SPDiffableCollectionDataSource: UICollectionViewDiffableDataSource<SP
8282
public func apply(_ sections: [SPDiffableSection], animated: Bool) {
8383
if #available(iOS 14, *) {
8484

85-
var snapshot = self.snapshot()
85+
// Remove section if it deleted from content.
8686

87-
// Remove section if it deleted from content
87+
var snapshot = self.snapshot()
8888

8989
let deletedSections = snapshot.sectionIdentifiers.filter({ (checkSection) -> Bool in
9090
return !sections.contains(where: { $0.identifier == checkSection.identifier })
@@ -94,7 +94,7 @@ open class SPDiffableCollectionDataSource: UICollectionViewDiffableDataSource<SP
9494
apply(snapshot, animated: true)
9595
}
9696

97-
// Reoder sections
97+
// Reoder
9898

9999
for (sectionIndex, section) in sections.enumerated() {
100100
let previousSectionIndex = sectionIndex - 1
@@ -105,7 +105,11 @@ open class SPDiffableCollectionDataSource: UICollectionViewDiffableDataSource<SP
105105
snapshot.moveSection(section, afterSection: previousSection)
106106
}
107107

108-
// Add new sections and update current sections
108+
// Apply Sections Changes
109+
110+
apply(snapshot, animated: true)
111+
112+
// Update current sections.
109113

110114
for section in sections {
111115
var sectionSnapshot = SPDiffableSectionSnapshot()
@@ -123,11 +127,6 @@ open class SPDiffableCollectionDataSource: UICollectionViewDiffableDataSource<SP
123127
sectionSnapshot.expand(sectionSnapshot.items)
124128
apply(sectionSnapshot, to: section, animatingDifferences: animated)
125129
}
126-
127-
// Apply changes
128-
129-
apply(snapshot, animated: true)
130-
131130
} else {
132131
var snapshot = SPDiffableSnapshot()
133132
snapshot.appendSections(sections)

0 commit comments

Comments
 (0)