Skip to content

Commit 04ea590

Browse files
committed
Preliminary work for GRDB7
There remains a warning in DatabaseRegionObservation+Rx.swift. See #72
1 parent fd14b91 commit 04ea590

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

Package.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import PackageDescription
55
let package = Package(
66
name: "RxGRDB",
77
platforms: [
8-
.iOS(.v11),
9-
.macOS(.v10_13),
10-
.tvOS(.v11),
11-
.watchOS(.v4),
8+
.iOS(.v13),
9+
.macOS(.v10_15),
10+
.tvOS(.v13),
11+
.watchOS(.v7),
1212
],
1313
products: [
1414
.library(name: "RxGRDB", targets: ["RxGRDB"]),
1515
],
1616
dependencies: [
17-
.package(url: "https://github.com/groue/GRDB.swift.git", .upToNextMajor(from: "6.0.0")),
17+
.package(url: "https://github.com/groue/GRDB.swift.git", .upToNextMajor(from: "7.0.0")),
1818
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "6.0.0"))
1919
],
2020
targets: [

Sources/RxGRDB/DatabaseWriter+Rx.swift

+7-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extension Reactive where Base: DatabaseWriter {
3232
/// - parameter updates: A closure which writes in the database.
3333
public func write<T>(
3434
observeOn scheduler: ImmediateSchedulerType = MainScheduler.instance,
35-
updates: @escaping (Database) throws -> T)
35+
updates: @escaping @Sendable (Database) throws -> T)
3636
-> Single<T>
3737
{
3838
Single
@@ -67,8 +67,8 @@ extension Reactive where Base: DatabaseWriter {
6767
/// - parameter value: A closure which reads from the database.
6868
public func write<T, U>(
6969
observeOn scheduler: ImmediateSchedulerType = MainScheduler.instance,
70-
updates: @escaping (Database) throws -> T,
71-
thenRead value: @escaping (Database, T) throws -> U)
70+
updates: @escaping @Sendable (Database) throws -> T,
71+
thenRead value: @escaping @Sendable (Database, T) throws -> U)
7272
-> Single<U>
7373
{
7474
Single
@@ -84,9 +84,12 @@ extension Reactive where Base: DatabaseWriter {
8484
observer(.failure(error))
8585
return
8686
}
87+
88+
// Non-mutable copy so that compiler does not raise any warning.
89+
let updatesValue2 = updatesValue
8790
self.base.spawnConcurrentRead { dbResult in
8891
do {
89-
try observer(.success(value(dbResult.get(), updatesValue!)))
92+
try observer(.success(value(dbResult.get(), updatesValue2!)))
9093
} catch {
9194
observer(.failure(error))
9295
}

Sources/RxGRDB/ValueObservation+Rx.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Dispatch
12
import GRDB
23
import RxSwift
34

0 commit comments

Comments
 (0)