How to store Public Data in ICloud

I have been working on an ios application which I decided to use the new SwiftData architecture, and I now have realized that SwiftData does not support public or shared databases using SwiftData.

I am a new and upcoming Swift developer, who has been self learning the Apple Swift technology. I just learned in this forum that Swift Data does not support Public and Shared Data and I also understand that no plans that have been announced to addressed this feature in the IOS 18 release time frame.

The use case for my application is to implement a social type application, something like applications including X, facebook, etc. These type of applications appear to use Public, Shared and Private data in various existing Apple application.

I would like to complete an application using Swift using ICloud, but I must assume that these current social applications are using other technologies. I am assuming you can do this in Core Data, but my understanding is Apple is asking that we use Swift Data to replace core data. I also am assuming that Swift data is built on core data technology layers. So ... to me it seems hopeful, somehow, to accomplish this using IOS 17 and follow the recommend Swift Data Path.

What are my options for completing these data objectives in IOS? I hope I am addressing these questions in the proper and best forum? Much thanks for any suggestions.

Answered by Bill3D in 787362022

It has been a little annoying to me how the technologies fork and then you have parallel paths to the same thing but with different obstacles in the paths. I haven't even had a chance to touch SwiftData. It's tough to try to master something before the replacement is introduced. The nature of tech, I guess. But CoreData has NSPersistantCloudKitContainer where the databaseScope can be set to public. I followed this video and it works great for my use case and scale. Although I would think a typical social media app would be more server side intensive and require server side logic.

Accepted Answer

It has been a little annoying to me how the technologies fork and then you have parallel paths to the same thing but with different obstacles in the paths. I haven't even had a chance to touch SwiftData. It's tough to try to master something before the replacement is introduced. The nature of tech, I guess. But CoreData has NSPersistantCloudKitContainer where the databaseScope can be set to public. I followed this video and it works great for my use case and scale. Although I would think a typical social media app would be more server side intensive and require server side logic.

Thank you Bill, I agree that having an API is key. I am new to IOS development and have been evaluating how I could do just that. Build an API in the ICloud. I would hope this is supported. Thanks so much to your Reply. I will follow your video. I provide the social media app use case, which is a future goal.

This is something that i'm following up as well. I have an app idea in mind but it needs a public database. To be more specific it is for buying and selling stuff so public database is a core functionality. Now i have learned SwiftData as my first persistent database just to find out that it doesn't support public database. Disaster. Now i have to two options, either wait for WWDC24 and see if SwiftData will support public db, either learn Core Data from scratch which will leave me prone to bugs and a lot of struggle as i'm not familiar with CD. Surely i can opt for FireBase as a backend but i don't want that, i don't trust Google simply because they can spy your customers at any time and introduce analytics in your app unannounced. This is something that won't happen with CloudKit and on top of that the project builds faster with CloudKit.

How to store Public Data in ICloud
 
 
Q