GRDB 5.17.0 with Swift Concurrency

Hello Swift community,

GRDB 5.17.0 is out, with support for Swift concurrency!

Starting Xcode 13.2+, you can now await your SQLite database. For example:

// Async read
let playerCount = try await { db in
    try Player.fetchCount(db)

// Async write
let newPlayerCount = try await dbQueue.write { db -> Int in
    try Player(...).insert(db)
    return try Player.fetchCount(db)

// Async database observation
let playerCounts = ValueObservation
    .values(in: dbQueue)
for try await playerCount in playerCounts { ... }

All async apis are :fire: EXPERIMENTAL. You can help them become stable: provide feedback.

For more details about GRDB 5.17.0, see the Release Notes.

Happy GRDB (sponsoring is available)!

Terms of Service

Privacy Policy

Cookie Policy