Skip to content

Commit

Permalink
Merge pull request #26 from harlanhaskins/master
Browse files Browse the repository at this point in the history
Adds a completion handler to UICollectionView.animateItemChanges
  • Loading branch information
wokalski authored Dec 8, 2016
2 parents b4a2b9e + 36fa2a4 commit f564aa4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/Diff+UIKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ public extension UICollectionView {
/// - parameter newData: Data which reflects the current state of UITableView
public func animateItemChanges<T: Collection>(
oldData: T,
newData: T
newData: T,
completion: ((Bool) -> Void)? = nil
) where T.Iterator.Element: Equatable {
performBatchUpdates({
let update = BatchUpdate(diff: oldData.extendedDiff(newData))
self.deleteItems(at: update.deletions)
self.insertItems(at: update.insertions)
update.moves.forEach { self.moveItem(at: $0.from, to: $0.to) }
}, completion: nil)
}, completion: completion)
}
}

Expand Down

0 comments on commit f564aa4

Please sign in to comment.