From bd7031ec9b9638ac5aeb3b3569d7cdc52526d10b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 1 Nov 2026 21:04:16 +0100 Subject: [PATCH] Fix typos in the demo app --- .../GRDBDemo/Database/AppDatabase.swift | 20 +++++++++---------- .../GRDBDemo/Database/Models/Player.swift | 2 +- .../GRDBDemo/Database/Persistence.swift | 2 +- .../GRDBDemo/Resources/Localizable.xcstrings | 4 ++-- ...EditionView.swift => PlayerEditView.swift} | 4 ++-- .../GRDBDemo/Views/PlayerListModel.swift | 6 +++--- .../GRDBDemo/Views/PlayerListView.swift | 2 +- .../Views/PlayersNavigationView.swift | 2 +- Documentation/DemoApps/GRDBDemo/README.md | 8 ++++---- 9 files changed, 25 insertions(+), 25 deletions(-) rename Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/{PlayerEditionView.swift => PlayerEditView.swift} (91%) diff --git a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/AppDatabase.swift b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/AppDatabase.swift index e3965accb..c4ccf834b 100644 --- a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/AppDatabase.swift +++ b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/AppDatabase.swift @@ -18,7 +18,7 @@ struct AppDatabase: Sendable { /// See private let dbWriter: any DatabaseWriter - /// Creates a `AppDatabase`, and makes sure the database schema + /// Creates an `AppDatabase`, and makes sure the database schema /// is ready. /// /// - important: Create the `DatabaseWriter` with a configuration @@ -62,7 +62,7 @@ struct AppDatabase: Sendable { // MARK: - Database Configuration extension AppDatabase { - // Uncomment for enabling SQL logging + // Uncomment to enable SQL logging // private static let sqlLogger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "SQL") /// Returns a database configuration suited for `AppDatabase`. @@ -76,7 +76,7 @@ extension AppDatabase { // db.add(function: ...) // } // - // Uncomment for enabling SQL logging if the `SQL_TRACE` environment variable is set. + // Uncomment to enable SQL logging if the `SQL_TRACE` environment variable is set. // See // if ProcessInfo.processInfo.environment["SQL_TRACE"] != nil { // config.prepareDatabase { db in @@ -114,25 +114,25 @@ extension AppDatabase { } } - /// Delete the specified players + /// Deletes the specified players func deletePlayers(ids: [Int64]) throws { try dbWriter.write { db in _ = try Player.deleteAll(db, keys: ids) } } - /// Delete all players + /// Deletes all players func deleteAllPlayers() throws { try dbWriter.write { db in _ = try Player.deleteAll(db) } } - /// Refresh all players (by performing some random changes, for demo purpose). + /// Refreshes all players (by performing some random changes, for demo purposes). func refreshPlayers() async throws { try await dbWriter.write { db in if try Player.all().isEmpty(db) { - // When database is empty, insert new random players + // When the database is empty, insert new random players try createRandomPlayers(db) } else { // Insert a player @@ -155,7 +155,7 @@ extension AppDatabase { } } - /// Create random players if the database is empty. + /// Creates random players if the database is empty. func createRandomPlayersIfEmpty() throws { try dbWriter.write { db in if try Player.all().isEmpty(db) { @@ -175,11 +175,11 @@ extension AppDatabase { // MARK: - Database Access: Reads // This demo app does not provide any specific reading method, and instead -// gives an unrestricted read-only access to the rest of the application. +// gives unrestricted read-only access to the rest of the application. // In your app, you are free to choose another path, and define focused // reading methods. extension AppDatabase { - /// Provides a read-only access to the database. + /// Provides read-only access to the database. var reader: any GRDB.DatabaseReader { dbWriter } diff --git a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/Models/Player.swift b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/Models/Player.swift index d92014c55..392067a2d 100644 --- a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/Models/Player.swift +++ b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/Models/Player.swift @@ -9,7 +9,7 @@ struct Player: Equatable { /// The player id. /// /// Int64 is the recommended type for auto-incremented database ids. - /// Use nil for players that are not inserted yet in the database. + /// Use nil for players that are not inserted in the database yet. var id: Int64? var name: String var score: Int diff --git a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/Persistence.swift b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/Persistence.swift index 51f3e4fd7..24b2a8cda 100644 --- a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/Persistence.swift +++ b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Database/Persistence.swift @@ -26,7 +26,7 @@ extension AppDatabase { // Create the AppDatabase let appDatabase = try AppDatabase(dbPool) - // Populate the database if it is empty, for better demo purpose. + // Populate the database if it is empty, for a better demo. try appDatabase.createRandomPlayersIfEmpty() return appDatabase diff --git a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Resources/Localizable.xcstrings b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Resources/Localizable.xcstrings index 8d20dbef0..d1f49ee2f 100644 --- a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Resources/Localizable.xcstrings +++ b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Resources/Localizable.xcstrings @@ -24,7 +24,7 @@ "zero" : { "stringUnit" : { "state" : "translated", - "value" : "No Player" + "value" : "No Players" } } } @@ -52,7 +52,7 @@ "zero" : { "stringUnit" : { "state" : "translated", - "value" : "0 point" + "value" : "0 points" } } } diff --git a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerEditionView.swift b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerEditView.swift similarity index 91% rename from Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerEditionView.swift rename to Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerEditView.swift index 0bbe76aa7..4005921e6 100644 --- a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerEditionView.swift +++ b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerEditView.swift @@ -1,6 +1,6 @@ import SwiftUI -struct PlayerEditionView: View { +struct PlayerEditView: View { @Environment(\.isPresented) var isPresented @Environment(\.appDatabase) var appDatabase @State var form: PlayerForm @@ -36,6 +36,6 @@ struct PlayerEditionView: View { #Preview { NavigationStack { - PlayerEditionView(player: .makeRandom()) + PlayerEditView(player: .makeRandom()) } } diff --git a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerListModel.swift b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerListModel.swift index 2c1fa4909..b5ac6dbe9 100644 --- a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerListModel.swift +++ b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerListModel.swift @@ -65,7 +65,7 @@ import GRDB // MARK: - Actions - /// Delete players at specified indexes in `self.players`. + /// Delete players at the specified indexes in `self.players`. func deletePlayers(at offsets: IndexSet) throws { let playerIds = offsets.compactMap { players[$0].id } try appDatabase.deletePlayers(ids: playerIds) @@ -76,12 +76,12 @@ import GRDB try appDatabase.deleteAllPlayers() } - /// Refresh all players (by performing some random changes, for demo purpose). + /// Refresh all players (by performing some random changes, for demo purposes). func refreshPlayers() async throws { try await appDatabase.refreshPlayers() } - /// Perform 50 refreshes in parallel, for demo purpose. + /// Perform 50 refreshes in parallel, for demo purposes. func refreshPlayersManyTimes() async throws { try await withThrowingTaskGroup(of: Void.self) { group in for _ in 0..<50 { diff --git a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerListView.swift b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerListView.swift index 0f3316512..6de33b0f6 100644 --- a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerListView.swift +++ b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayerListView.swift @@ -8,7 +8,7 @@ struct PlayerListView: View { List { ForEach(model.players, id: \.id) { player in NavigationLink { - PlayerEditionView(player: player) + PlayerEditView(player: player) } label: { PlayerRow(player: player) } diff --git a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayersNavigationView.swift b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayersNavigationView.swift index b6e96ac2d..e3cb57756 100644 --- a/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayersNavigationView.swift +++ b/Documentation/DemoApps/GRDBDemo/GRDBDemo/Views/PlayersNavigationView.swift @@ -77,7 +77,7 @@ private struct ContentView: View { .buttonStyle(.borderedProminent) } // Hide the title, but set a string anyway in order to avoid - // an odd relayout when player list becomes empty during + // an odd relayout when the player list becomes empty during // the tornado. .navigationTitle("") } diff --git a/Documentation/DemoApps/GRDBDemo/README.md b/Documentation/DemoApps/GRDBDemo/README.md index 96f375407..c71246e67 100644 --- a/Documentation/DemoApps/GRDBDemo/README.md +++ b/Documentation/DemoApps/GRDBDemo/README.md @@ -5,7 +5,7 @@ GRDBDemo Application **GRDBDemo demonstrates how GRDB can fuel a SwiftUI application.** -> **Note**: This demo app is not a project template. Do not copy it as a starting point for your application. Instead, create a new project, choose a GRDB [installation method](../../../README.md#installation), and use the demo as an inspiration. +> **Note**: This demo app is not a project template. Do not copy it as a starting point for your application. Instead, create a new project, choose a GRDB [installation method](../../../README.md#installation), and use the demo as inspiration. The topics covered in this demo are: @@ -29,15 +29,15 @@ The topics covered in this demo are: - [Persistence.swift](GRDBDemo/Database/Persistence.swift) - This file instantiates various `AppDatabase` for the various projects' needs: one database on disk for the application, and in-memory databases for SwiftUI previews. + This file instantiates `AppDatabase` instances for the various needs of the project: one database on disk for the application, and in-memory databases for SwiftUI previews. - [Player.swift](GRDBDemo/Database/Models/Player.swift) - `Player` is a [Record](../../../README.md#records) type, able to read and write in the database. It conforms to the standard Codable protocol in order to gain all advantages of [Codable Records](../../../README.md#codable-records). + `Player` is a [Record](../../../README.md#records) type, able to read and write in the database. It conforms to the standard Codable protocol in order to gain all the advantages of [Codable Records](../../../README.md#codable-records). - [PlayerListModel.swift](GRDBDemo/Views/PlayerListModel.swift) - `PlayerListModel` is an `@Observable` object that observes the database, displays always fresh values on screen, and performs actions. + `PlayerListModel` is an `@Observable` object that observes the database, always displays fresh values on screen, and performs actions. `PlayerListModel` is [tested](GRDBDemoTests/PlayerListModelTests.swift).