Skip to content

Commit

Permalink
Merge pull request #24 from zenangst/improve/calling-completion-in-ex…
Browse files Browse the repository at this point in the history
…tensions

Use performBatchUpdates completion in extensions
  • Loading branch information
zenangst authored Nov 25, 2019
2 parents da37a6a + fe6f5a7 commit a40fb61
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Differific.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "Differific"
s.summary = "A fast and convenient diffing framework"
s.version = "0.8.3"
s.version = "0.8.4"
s.homepage = "https://github.com/zenangst/Differific"
s.license = 'MIT'
s.author = { "Christoffer Winterkvist" => "[email protected]" }
Expand Down
4 changes: 2 additions & 2 deletions Source/iOS+tvOS/UICollectionView+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ extension UICollectionView {
moveItem(at: $0.from, to: $0.to)
}
}
}, completion: { _ in
completion?()
})

completion?()
}

private func validateUpdates(_ collection: [IndexPath], then: ([IndexPath]) -> Void) {
Expand Down
5 changes: 3 additions & 2 deletions Source/iOS+tvOS/UITableView+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public extension UITableView {
if !result.moves.isEmpty {
result.moves.forEach { moveRow(at: $0.from, to: $0.to) }
}
}, completion: { _ in
completion?()
})
} else {
beginUpdates()
Expand All @@ -53,9 +55,8 @@ public extension UITableView {
result.moves.forEach { moveRow(at: $0.from, to: $0.to) }
}
endUpdates()
completion?()
}

completion?()
}

private func validateUpdates(_ collection: [IndexPath],
Expand Down
6 changes: 3 additions & 3 deletions Source/macOS/NSCollectionView+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public extension NSCollectionView {
if !result.moves.isEmpty {
result.moves.forEach { object.moveItem(at: $0.from, to: $0.to) }
}
}, completionHandler: nil)
}, completionHandler: { _ in
completion?()
})

needsLayout = true

completion?()
}

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

0 comments on commit a40fb61

Please sign in to comment.