Skip to content

Commit a40fb61

Browse files
authored
Merge pull request #24 from zenangst/improve/calling-completion-in-extensions
Use performBatchUpdates completion in extensions
2 parents da37a6a + fe6f5a7 commit a40fb61

4 files changed

+9
-8
lines changed

Differific.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
s.name = "Differific"
33
s.summary = "A fast and convenient diffing framework"
4-
s.version = "0.8.3"
4+
s.version = "0.8.4"
55
s.homepage = "https://github.com/zenangst/Differific"
66
s.license = 'MIT'
77
s.author = { "Christoffer Winterkvist" => "[email protected]" }

Source/iOS+tvOS/UICollectionView+Extensions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ extension UICollectionView {
4141
moveItem(at: $0.from, to: $0.to)
4242
}
4343
}
44+
}, completion: { _ in
45+
completion?()
4446
})
45-
46-
completion?()
4747
}
4848

4949
private func validateUpdates(_ collection: [IndexPath], then: ([IndexPath]) -> Void) {

Source/iOS+tvOS/UITableView+Extensions.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public extension UITableView {
4242
if !result.moves.isEmpty {
4343
result.moves.forEach { moveRow(at: $0.from, to: $0.to) }
4444
}
45+
}, completion: { _ in
46+
completion?()
4547
})
4648
} else {
4749
beginUpdates()
@@ -53,9 +55,8 @@ public extension UITableView {
5355
result.moves.forEach { moveRow(at: $0.from, to: $0.to) }
5456
}
5557
endUpdates()
58+
completion?()
5659
}
57-
58-
completion?()
5960
}
6061

6162
private func validateUpdates(_ collection: [IndexPath],

Source/macOS/NSCollectionView+Extensions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ public extension NSCollectionView {
3838
if !result.moves.isEmpty {
3939
result.moves.forEach { object.moveItem(at: $0.from, to: $0.to) }
4040
}
41-
}, completionHandler: nil)
41+
}, completionHandler: { _ in
42+
completion?()
43+
})
4244

4345
needsLayout = true
44-
45-
completion?()
4646
}
4747

4848
private func validateUpdates(_ collection: [IndexPath], then: (Set<IndexPath>) -> Void) {

0 commit comments

Comments
 (0)