Skip to content

Commit 95253c0

Browse files
committed
Make typing updates not as noisy
1 parent 94cb3ca commit 95253c0

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

CommonplaceBookApp/DocumentDiffableDataSource.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ public final class DocumentDiffableDataSource: UITableViewDiffableDataSource<Doc
9595
cardsPerDocument: cardsPerDocument,
9696
hashtag: filteredHashtag
9797
)
98-
apply(snapshot, animatingDifferences: animated)
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
103+
apply(snapshot, animatingDifferences: reallyAnimate)
99104
}
100105

101106
private static func snapshot(

CommonplaceBookApp/NoteArchiveDocument.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public final class NoteArchiveDocument: UIDocument {
7575

7676
private func schedulePropertyBatchUpdate() {
7777
guard propertyBatchUpdateTimer == nil else { return }
78-
propertyBatchUpdateTimer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: false, block: { _ in
78+
propertyBatchUpdateTimer = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false, block: { _ in
7979
let count = self.noteArchiveQueue.sync {
8080
self.noteArchive.batchUpdatePageProperties()
8181
}

0 commit comments

Comments
 (0)