From ce63cdfa60e0147e259568f6fbea677d52474a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 23 Jun 2024 16:24:47 +0200 Subject: [PATCH] AsyncValueObservation is Sendable --- GRDB/ValueObservation/ValueObservation.swift | 5 +++-- TODO.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/GRDB/ValueObservation/ValueObservation.swift b/GRDB/ValueObservation/ValueObservation.swift index 455b856e9..8ef9e7b7c 100644 --- a/GRDB/ValueObservation/ValueObservation.swift +++ b/GRDB/ValueObservation/ValueObservation.swift @@ -81,7 +81,7 @@ struct ValueObservationEvents: Refinable { var didCancel: (@Sendable () -> Void)? } -typealias ValueObservationStart = ( +typealias ValueObservationStart = @Sendable ( _ onError: @escaping @Sendable (Error) -> Void, _ onChange: @escaping @Sendable (T) -> Void) -> AnyDatabaseCancellable @@ -339,7 +339,8 @@ extension ValueObservation { /// You build an `AsyncValueObservation` from ``ValueObservation`` or /// ``SharedValueObservation``. @available(iOS 13, macOS 10.15, tvOS 13, *) -public struct AsyncValueObservation: AsyncSequence { +public struct AsyncValueObservation: AsyncSequence, @unchecked Sendable { + // @unchecked Sendable because of `BufferingPolicy`. public typealias BufferingPolicy = AsyncThrowingStream.Continuation.BufferingPolicy public typealias AsyncIterator = Iterator diff --git a/TODO.md b/TODO.md index c007aca1d..ddf63991d 100644 --- a/TODO.md +++ b/TODO.md @@ -113,7 +113,7 @@ - [X] association - [X] associationaggregate - [X] associationtomany - - [ ] asyncvalueobservation + - [X] asyncvalueobservation - [ ] asyncvalueobservation/iterator - [X] asyncvalueobservationscheduler - [ ] belongstoassociation