Skip to content

Commit

Permalink
Update obsolete documentation of stopObservingDatabaseChangesUntilNex…
Browse files Browse the repository at this point in the history
…tTransaction
  • Loading branch information
groue committed Nov 27, 2023
1 parent 06ac26a commit e29c52d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions GRDB/Core/TransactionObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -889,11 +889,12 @@ extension TransactionObserver {
/// The default implementation does nothing.
public func databaseDidChange() { }

/// Prevents the observer from receiving further change notifications until
/// the next transaction.
/// Prevents the observer from receiving further change notifications
/// until the next transaction.
///
/// After this method has been called, the ``databaseDidChange(with:)``
/// method won't be called until the next transaction.
/// and ``databaseDidChange()-7olv7`` methods won't be called until the
/// next transaction.
///
/// For example:
///
Expand All @@ -906,6 +907,13 @@ extension TransactionObserver {
/// return eventKind.tableName == "player"
/// }
///
/// func databaseDidChange() {
/// playerTableWasModified = true
///
/// // It is pointless to keep on tracking further changes:
/// stopObservingDatabaseChangesUntilNextTransaction()
/// }
///
/// func databaseDidChange(with event: DatabaseEvent) {
/// playerTableWasModified = true
///
Expand All @@ -916,7 +924,7 @@ extension TransactionObserver {
/// ```
///
/// - precondition: This method must be called from
/// ``databaseDidChange(with:)``.
/// ``databaseDidChange(with:)`` or ``databaseDidChange()-7olv7``.
public func stopObservingDatabaseChangesUntilNextTransaction() {
guard let broker = SchedulingWatchdog.current?.databaseObservationBroker else {
fatalError("""
Expand Down

0 comments on commit e29c52d

Please sign in to comment.