AsyncValueObservation

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public struct AsyncValueObservation<Element> : AsyncSequence

An asynchronous sequence of database changes.

Experimental

Usage:

let observation = ValueObservation.tracking(Player.fetchAll)
let dbQueue: DatabaseQueue: ...

// Each database change in the player prints "Fresh players: ..."
for try await players in observation.values(in: dbQueue) {
    print("Fresh players: \(players)")
}

See ValueObservation for more information.

Note

This async sequence never ends.