{"id":15527101,"url":"https://github.com/groue/grdbquery","last_synced_at":"2025-04-09T23:18:52.277Z","repository":{"id":39970084,"uuid":"431846769","full_name":"groue/GRDBQuery","owner":"groue","description":"The SwiftUI companion for GRDB","archived":false,"fork":false,"pushed_at":"2025-03-15T13:27:19.000Z","size":2153,"stargazers_count":264,"open_issues_count":0,"forks_count":22,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-09T23:18:46.698Z","etag":null,"topics":["database","database-observation","grdb","sqlite","swiftui"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/groue.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["groue"]}},"created_at":"2021-11-25T13:00:36.000Z","updated_at":"2025-04-05T14:45:25.000Z","dependencies_parsed_at":"2023-10-15T10:16:09.500Z","dependency_job_id":"c7af98ff-303a-42d5-89fd-018919f2e1f9","html_url":"https://github.com/groue/GRDBQuery","commit_stats":{"total_commits":77,"total_committers":1,"mean_commits":77.0,"dds":0.0,"last_synced_commit":"aefc0d7e7a64e841da33e1c8be7429da1bd9b5d6"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groue%2FGRDBQuery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groue%2FGRDBQuery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groue%2FGRDBQuery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groue%2FGRDBQuery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/groue","download_url":"https://codeload.github.com/groue/GRDBQuery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125614,"owners_count":21051772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","database-observation","grdb","sqlite","swiftui"],"created_at":"2024-10-02T11:04:26.592Z","updated_at":"2025-04-09T23:18:52.252Z","avatar_url":"https://github.com/groue.png","language":"Swift","readme":"# GRDBQuery\n\n**Latest release**: March 15, 2025 • [version 0.11.0](https://github.com/groue/GRDBQuery/tree/0.11.0) • [CHANGELOG](CHANGELOG.md)\n\n**Requirements**: iOS 14.0+ / macOS 11+ / tvOS 14.0+ / watchOS 7.0+ \u0026bull; Swift 6+ / Xcode 16+\n\n📖 **[Documentation]**\n\n---\n\nGRDBQuery helps SwiftUI applications access a local SQLite database through [GRDB] and the SwiftUI environment.\n\nIt comes in two flavors:\n\n- The `@Query` property wrapper allows SwiftUI views to directly read and observe the database:\n\n    ```swift\n    /// Displays an always up-to-date list of database players.\n    struct PlayerList: View {\n        @Query(PlayersRequest()) var players: [Player]\n        \n        var body: some View {\n            List(players) { player in Text(player.name) }\n        }\n    }\n    ```\n\n- The `@EnvironmentStateObject` property wrapper helps building `ObservableObject` models from the SwiftUI environment:\n\n    ```swift\n    /// Displays an always up-to-date list of database players.\n    struct PlayerList: View {\n        @EnvironmentStateObject var model: PlayerListModel = []\n        \n        init() {\n            _model = EnvironmentStateObject { env in\n                PlayerListModel(databaseContext: env.databaseContext)\n            }\n        }\n        \n        var body: some View {\n            List(model.players) { player in Text(player.name) }\n        }\n    }\n    ```\n\nBoth techniques can be used in a single application, so that developers can run quick experiments, build versatile previews, and also apply strict patterns and conventions. Pick `@Query`, or `@EnvironmentStateObject`, depending on your needs!\n\n## Documentation\n\nLearn how to use `@Query` and `@EnvironmentStateObject` in the **[Documentation]**.\n\nCheck out the **[GRDBQuery demo apps]**, and the **[GRDB demo apps]** for various examples.\n\n## Thanks\n\n🙌 `@Query` was vastly inspired from [Core Data and SwiftUI](https://davedelong.com/blog/2021/04/03/core-data-and-swiftui/) by [@davedelong](https://github.com/davedelong), with [a critical improvement](https://github.com/groue/GRDB.swift/pull/955) contributed by [@steipete](https://github.com/steipete), and enhancements inspired by conversations with [@stephencelis](https://github.com/stephencelis). Many thanks to all of you!\n\n\n[GRDB]: http://github.com/groue/GRDB.swift\n[GRDB demo apps]: https://github.com/groue/GRDB.swift/tree/master/Documentation/DemoApps\n[Documentation]: https://swiftpackageindex.com/groue/GRDBQuery/documentation\n[GRDBQuery demo apps]: Documentation\n","funding_links":["https://github.com/sponsors/groue"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroue%2Fgrdbquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgroue%2Fgrdbquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroue%2Fgrdbquery/lists"}