File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## [ 0.3.0] - 2019-08-07
4+
5+ ### Changed
6+
7+ - Faster typing propagation between master & detail view
8+
39## [ 0.2.0] - 2019-08-03
410
511### Changed
Original file line number Diff line number Diff line change @@ -95,14 +95,21 @@ public final class DocumentDiffableDataSource: UITableViewDiffableDataSource<Doc
9595 cardsPerDocument: cardsPerDocument,
9696 hashtag: filteredHashtag
9797 )
98- // Only animate inserts & deletes.
99- // In particular I don't want to animate reloads as I type -- it's too noisy
100- // I'm said I'm losing reordering animations :-(
101- // Is there some way, when observing the notebook, to know that it was a typing change?
102- let reallyAnimate = animated && self . snapshot ( ) . numberOfItems != snapshot. numberOfItems
98+ let reallyAnimate = animated && DocumentDiffableDataSource . majorSnapshotDifferences ( between: self . snapshot ( ) , and: snapshot)
10399 apply ( snapshot, animatingDifferences: reallyAnimate)
104100 }
105101
102+ /// Compares lhs & rhs to see if the differences are worth animating.
103+ private static func majorSnapshotDifferences( between lhs: Snapshot , and rhs: Snapshot ) -> Bool {
104+ if lhs. numberOfItems != rhs. numberOfItems {
105+ return true
106+ }
107+ for (lhsItem, rhsItem) in zip ( lhs. itemIdentifiers, rhs. itemIdentifiers) {
108+ if lhsItem. pageKey != rhsItem. pageKey { return true }
109+ }
110+ return false
111+ }
112+
106113 private static func snapshot(
107114 for notebook: NoteArchiveDocument ,
108115 cardsPerDocument: [ String : Int ] ,
You can’t perform that action at this time.
0 commit comments