SwiftData Custom Datastore Docs and Implementation

I have watched the following WWDC 2024 sessions:

  • What’s new in SwiftData

  • Create a custom data store with SwiftData

  • Platform State of the Union

Now, I have an application that exposes a GraphQL API endpoint that's using PostgreSQL Server 16.3 database. Next, this API returns JSON to the client application (i.e. SwiftUI app). Furthermore, I have checked the current documentation and the above videos appear to be the best reference at this time.

My proposed architecture looks like the following:

SwiftUI <--> SwiftData <--> PostgreStoreConfiguration && PostgreStore TBD <--> GraphQL API <--> PostgreSQL

Thus, I have the following questions:

  1. Are there plans to add common out-of-the-box data store implementations for PostgreSQL, Cassandra, Redis, and so on?

  2. Will it be possible to implement data stores built to use gRPC, GraphQL, REST, and others to name a few?

  3. Will there be more documentation on the actual creation of a custom data store because the current documentation provides a slim API reference?

I look forward to your feedback regarding the SwiftData custom data stores.

Answered by DTS Engineer in 790727022

As of today, the "Create a custom data store with SwiftData" WWDC video is what we have. If you need more documentation, which I believe you do, I suggest that you file a feedback report.

The new DataStore API is supposed to provide enough interfaces for you to access your own storage via SwiftData, so for your question #2, it is possible. It is up to you to bridge the interfaces to your storage though.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Accepted Answer

As of today, the "Create a custom data store with SwiftData" WWDC video is what we have. If you need more documentation, which I believe you do, I suggest that you file a feedback report.

The new DataStore API is supposed to provide enough interfaces for you to access your own storage via SwiftData, so for your question #2, it is possible. It is up to you to bridge the interfaces to your storage though.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

SwiftData Custom Datastore Docs and Implementation
 
 
Q