Require Swift 5.6 Compiler for Concurrency Support

This commit is contained in:
Gwendal Roué committed 2022-04-13 23:07:33 +02:00
1 parent 15c06e0374
commit 209192d3a5
17 files changed
+24 -24

No files matched your search

+1 -1
View File
@@ -137,7 +137,7 @@ try dbQueue.write { db in
<details>
<summary><b>Swift concurrency</b> (async/await)</summary>
[**:fire: EXPERIMENTAL**](../README.md#what-are-experimental-features) GRDB support for Swift concurrency requires Xcode 13.2+.
[**:fire: EXPERIMENTAL**](../README.md#what-are-experimental-features) GRDB support for Swift concurrency requires Xcode 13.3.1+.
```swift
let playerCount = try await dbQueue.read { db in
+1 -1
View File
@@ -160,7 +160,7 @@ public final class DatabasePool: DatabaseWriter {
}
}
#if swift(>=5.5) && canImport(_Concurrency)
#if swift(>=5.6) && canImport(_Concurrency)
// @unchecked because of databaseSnapshotCount and readerPool
extension DatabasePool: @unchecked Sendable { }
#endif
+1 -1
View File
@@ -371,7 +371,7 @@ extension DatabaseReader {
}
}
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
extension DatabaseReader {
// MARK: - Asynchronous Database Access
+1 -1
View File
@@ -159,7 +159,7 @@ extension DatabaseValue: StatementBinding {
extension DatabaseValue: GRDBSendable { }
#if swift(>=5.5) && canImport(_Concurrency)
#if swift(>=5.6) && canImport(_Concurrency)
// @unchecked due to Foundation.Data not conforming to Sendable
// TODO: Remove @unchecked when Foundation has been upgraded
extension DatabaseValue.Storage: @unchecked Sendable { }
+1 -1
View File
@@ -380,7 +380,7 @@ extension DatabaseWriter {
}
}
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
extension DatabaseWriter {
// MARK: - Asynchronous Database Access
+1 -1
View File
@@ -2182,7 +2182,7 @@ struct ArrayRowImpl: RowImpl {
}
}
#if swift(>=5.5) && canImport(_Concurrency)
#if swift(>=5.6) && canImport(_Concurrency)
// @unchecked because columns property is not inferred as Sendable
// TODO: remove this @unchecked when compiler can handle tuples.
extension ArrayRowImpl: @unchecked Sendable { }
+1 -1
View File
@@ -249,7 +249,7 @@ final class SerializedDatabase {
}
}
#if swift(>=5.5) && canImport(_Concurrency)
#if swift(>=5.6) && canImport(_Concurrency)
// @unchecked because the wrapped `Database` itself is not Sendable.
// It happens the job of SerializedDatabase is precisely to provide thread-safe
// access to `Database`.
+1 -1
View File
@@ -32,7 +32,7 @@ public protocol _OptionalProtocol {
/// :nodoc:
extension Optional: _OptionalProtocol { }
#if swift(>=5.5) && canImport(_Concurrency)
#if swift(>=5.6) && canImport(_Concurrency)
public typealias GRDBSendable = Swift.Sendable
#else
public typealias GRDBSendable = Any
@@ -299,7 +299,7 @@ public final class SharedValueObservation<Element> {
}
}
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
extension SharedValueObservation {
// MARK: - Asynchronous Observation
/// The database observation, as an asynchronous sequence of
+1 -1
View File
@@ -252,7 +252,7 @@ extension ValueObservation: Refinable {
}
}
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
extension ValueObservation {
// MARK: - Asynchronous Observation
/// The database observation, as an asynchronous sequence of
+1 -1
View File
@@ -72,7 +72,7 @@ GRDB ships with:
- [WAL Mode Support](#database-pools): Extra performance for multi-threaded applications.
- [Migrations]: Transform your database as your application evolves.
- [Database Observation]: Observe database changes and transactions.
- [Swift Concurrency]: `try await` your database (Xcode 13.2+).
- [Swift Concurrency]: `try await` your database (Xcode 13.3.1+).
- [Combine Support]: Access and observe the database with Combine publishers.
- [RxSwift Support](http://github.com/RxSwiftCommunity/RxGRDB): Access and observe the database with RxSwift observables.
- [Full-Text Search]
+1 -1
View File
@@ -51,7 +51,7 @@ final class Test<Context> {
}
}
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
final class AsyncTest<Context> {
// Raise the repeatCount in order to help spotting flaky tests.
+3 -3
View File
@@ -30,7 +30,7 @@ class DatabaseReaderTests : GRDBTestCase {
try test(setup(makeDatabasePool()).makeSnapshot())
}
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func testAsyncAwait_ReadCanRead() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
@@ -68,7 +68,7 @@ class DatabaseReaderTests : GRDBTestCase {
try test(makeDatabasePool().makeSnapshot())
}
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func testAsyncAwait_ReadPreventsDatabaseModification() async throws {
func test(_ dbReader: DatabaseReader) async throws {
@@ -107,7 +107,7 @@ class DatabaseReaderTests : GRDBTestCase {
try test(setup(makeDatabasePool()).makeSnapshot())
}
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func testAsyncAwait_UnsafeReadCanRead() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
+6 -6
View File
@@ -266,7 +266,7 @@ class DatabaseWriterTests : GRDBTestCase {
try DatabaseQueue().backup(to: dbQueue)
}
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func testAsyncAwait_write() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
@@ -288,7 +288,7 @@ class DatabaseWriterTests : GRDBTestCase {
}
#endif
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func testAsyncAwait_writeWithoutTransaction() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
@@ -313,7 +313,7 @@ class DatabaseWriterTests : GRDBTestCase {
}
#endif
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func testAsyncAwait_barrierWriteWithoutTransaction() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
@@ -338,7 +338,7 @@ class DatabaseWriterTests : GRDBTestCase {
}
#endif
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func testAsyncAwait_erase() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
@@ -358,7 +358,7 @@ class DatabaseWriterTests : GRDBTestCase {
}
#endif
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func testAsyncAwait_vacuum() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
@@ -376,7 +376,7 @@ class DatabaseWriterTests : GRDBTestCase {
}
#endif
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.16, iOS 14, tvOS 14, watchOS 7, *) // async + vacuum into
func testAsyncAwait_vacuumInto() async throws {
// Prevent SQLCipher failures
+1 -1
View File
@@ -259,7 +259,7 @@ public struct AnyValueReducer<Fetched, Value>: ValueReducer {
}
}
#if swift(>=5.5) && canImport(_Concurrency)
#if swift(>=5.6) && canImport(_Concurrency)
// Assume this is correct :-/
extension XCTestExpectation: @unchecked Sendable { }
#endif
@@ -621,7 +621,7 @@ class SharedValueObservationTests: GRDBTestCase {
}
#endif
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
func testAsyncAwait() async throws {
let dbQueue = try makeDatabaseQueue()
+1 -1
View File
@@ -694,7 +694,7 @@ class ValueObservationTests: GRDBTestCase {
try test(makeDatabasePool())
}
#if compiler(>=5.5.2) && canImport(_Concurrency)
#if compiler(>=5.6) && canImport(_Concurrency)
// MARK: - Async Await
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)