Skip to content

Commit

Permalink
Mark ValueObservation starting methods as @preconcurrency
Browse files Browse the repository at this point in the history
I guess the compiler will learn to stop emitting warnings eventually.

https://mjtsai.com/blog/2024/09/20/unwanted-swift-concurrency-checking/
  • Loading branch information
groue committed Sep 21, 2024
1 parent b3c3314 commit c3872c8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions GRDB/Documentation.docc/Extension/ValueObservation.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ When needed, you can help GRDB optimize observations and reduce database content
### Accessing Observed Values

- ``publisher(in:scheduling:)``
- ``start(in:scheduling:onError:onChange:)-79cet``
- ``start(in:scheduling:onError:onChange:)-5wpgl``
- ``start(in:scheduling:onError:onChange:)-10vwf``
- ``start(in:scheduling:onError:onChange:)-7z197``
- ``values(in:scheduling:bufferingPolicy:)``
- ``DatabaseCancellable``
- ``ValueObservationScheduler``
Expand Down
2 changes: 1 addition & 1 deletion GRDB/ValueObservation/SharedValueObservation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public final class SharedValueObservation<Element: Sendable>: @unchecked Sendabl
/// - parameter onChange: The closure to execute on receipt of a
/// fresh value.
/// - returns: A DatabaseCancellable that can stop the observation.
public func start(
@preconcurrency public func start(
onError: @escaping @Sendable (Error) -> Void,
onChange: @escaping @Sendable (Element) -> Void)
-> AnyDatabaseCancellable
Expand Down
10 changes: 5 additions & 5 deletions GRDB/ValueObservation/ValueObservation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extension ValueObservation: Refinable {
/// - parameter onChange: The closure to execute on receipt of a
/// fresh value.
/// - returns: A DatabaseCancellable that can stop the observation.
public func start(
@preconcurrency public func start(
in reader: some DatabaseReader,
scheduling scheduler: some ValueObservationScheduler,
onError: @escaping @Sendable (Error) -> Void,
Expand Down Expand Up @@ -787,7 +787,7 @@ extension ValueObservation {
/// ```
///
/// - parameter fetch: The closure that fetches the observed value.
public static func trackingConstantRegion<Value>(
@preconcurrency public static func trackingConstantRegion<Value>(
_ fetch: @escaping @Sendable (Database) throws -> Value)
-> Self
where Reducer == ValueReducers.Fetch<Value>
Expand Down Expand Up @@ -859,7 +859,7 @@ extension ValueObservation {
/// - parameter otherRegions: A list of supplementary regions
/// to observe.
/// - parameter fetch: The closure that fetches the observed value.
public static func tracking<Value>(
@preconcurrency public static func tracking<Value>(
region: any DatabaseRegionConvertible,
_ otherRegions: any DatabaseRegionConvertible...,
fetch: @escaping @Sendable (Database) throws -> Value)
Expand Down Expand Up @@ -929,7 +929,7 @@ extension ValueObservation {
///
/// - parameter regions: An array of observed regions.
/// - parameter fetch: The closure that fetches the observed value.
public static func tracking<Value>(
@preconcurrency public static func tracking<Value>(
regions: [any DatabaseRegionConvertible],
fetch: @escaping @Sendable (Database) throws -> Value)
-> Self
Expand Down Expand Up @@ -987,7 +987,7 @@ extension ValueObservation {
/// ```
///
/// - parameter fetch: The closure that fetches the observed value.
public static func tracking<Value>(
@preconcurrency public static func tracking<Value>(
_ fetch: @escaping @Sendable (Database) throws -> Value)
-> Self
where Reducer == ValueReducers.Fetch<Value>
Expand Down

0 comments on commit c3872c8

Please sign in to comment.