Skip to content

Commit

Permalink
Merge pull request #17 from zenangst/feature/animations-on-mac-os
Browse files Browse the repository at this point in the history
Enable animations on macOS
  • Loading branch information
zenangst authored Apr 23, 2019
2 parents d33e9cc + 3f3f3d1 commit ef5d394
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 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.6.0"
s.version = "0.7.0"
s.homepage = "https://github.com/zenangst/Differific"
s.license = 'MIT'
s.author = { "Christoffer Winterkvist" => "[email protected]" }
Expand Down
10 changes: 5 additions & 5 deletions Source/macOS/NSCollectionView+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ public extension NSCollectionView {
let manager = IndexPathManager()
let result = manager.process(changes, section: section)

performBatchUpdates({
animator().performBatchUpdates({
updateDataSource()
validateUpdates(result.insert, then: insertItems)
validateUpdates(result.updates, then: reloadItems)
validateUpdates(result.deletions, then: deleteItems)
validateUpdates(result.insert, then: animator().insertItems)
validateUpdates(result.updates, then: animator().reloadItems)
validateUpdates(result.deletions, then: animator().deleteItems)
if !result.moves.isEmpty {
result.moves.forEach { moveItem(at: $0.from, to: $0.to) }
result.moves.forEach { animator().moveItem(at: $0.from, to: $0.to) }
}
}, completionHandler: nil)

Expand Down
12 changes: 6 additions & 6 deletions Source/macOS/NSTableView+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ public extension NSTableView {
let deletions = IndexSet(result.deletions.compactMap { $0.item })
let updates = IndexSet(result.updates.compactMap { $0.item })

beginUpdates()
animator().beginUpdates()
updateDataSource()
validateUpdates(insertions, animation: animation, then: insertRows)
validateUpdates(deletions, animation: animation, then: removeRows)
validateUpdates(insertions, animation: animation, then: animator().insertRows)
validateUpdates(deletions, animation: animation, then: animator().removeRows)

if !updates.isEmpty {
reloadData(forRowIndexes: updates, columnIndexes: IndexSet([section]))
animator().reloadData(forRowIndexes: updates, columnIndexes: IndexSet([section]))
}

if !result.moves.isEmpty {
result.moves.forEach { moveRow(at: $0.from.item, to: $0.to.item) }
result.moves.forEach { animator().moveRow(at: $0.from.item, to: $0.to.item) }
}

endUpdates()
animator().endUpdates()

completion?()
}
Expand Down

0 comments on commit ef5d394

Please sign in to comment.