Download Latest Version v7.6.1 source code.tar.gz (7.6 MB)
Email in envelope

Get an email when there's a new version of GRDB.swift

Home / v7.5.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2025-05-11 2.3 kB
v7.5.0 source code.tar.gz 2025-05-11 7.5 MB
v7.5.0 source code.zip 2025-05-11 7.9 MB
Totals: 3 Items   15.5 MB 0

A new release of the Swift toolkit for SQLite databases.

GRDB 7.5.0 brings a new way to write database requests

:::swift
// GRDB 7.4
let count = try Player.filter(Column("score") >= 1000).fetchCount(db)
let players = try Player.order(Column("score")).fetchAll(db)

// NEW with GRDB 7.5.0
let count = try Player.filter { $0.score >= 1000 }.fetchCount(db)
let players = try Player.order(\.score).fetchAll(db)

Record types profit from this new syntax if they define a nested Columns enum. If you follow the Recommended Practices for Designing Record Types, this Columns enum is already defined, and you can profit from the new syntax right away.

With Swift 6.1+, Table Aliases have learned to use the Columns enum:

:::swift
// GRDB 7.4
let authorAlias = TableAlias()
let request = Book
    .joining(required: Book.author.aliased(authorAlias))
    .order(authorAlias[Column("name")], Column("publishDate"))

// NEW with GRDB 7.5.0 and Swift 6.1
let authorAlias = TableAlias<Author>()
let request = Book
    .joining(required: Book.author.aliased(authorAlias))
    .order { [authorAlias.name, $0.publishDate] }

Breaking Changes

The benefits of this release are so important that two breaking changes were shipped:

  • If you define a public record type with a nested Columns enum, you have to make this enum public as well.

    diff public struct Player: FetchableRecord, PersistableRecord { - enum Columns { ... } + public enum Columns { ... } }

  • TableAlias is now a generic type. This will break existing code that accepts a TableAlias as an argument. You will have to make those methods generic as well.

What's Changed

Full Changelog: https://github.com/groue/GRDB.swift/compare/v7.4.1...v7.5.0

Source: README.md, updated 2025-05-11