|
I'm having a lot of trouble finding resources that show how Swift Data works with CloudKit. I've never worked with Core Data before so I don't really understand what's going on in tutorials that use it with CloudKit. I'm trying to transition from Firebase to Cloudkit. There are a few of Models/Records I want to be shared between multiple Users. It's a event app that consists of these models: Location, Event, Attendee, and Post. I don't want Locations to be tied to any one User, and I want Event to be owned by more than one User. Post would be owned by a single User, and Attendee would describe accommodations or details about the User's attendance. I understand general database schemas, I just don't understand how any of this works between CloudKit Containers and Swift Data. If anyone can point me to info that explains it, or give me some insight, I would appreciate it. |
|
|
|
Disclaimer: Currently, there seem to be some bugs when sharing data between different devices and sometimes it simply doesn't work. So it's difficult to differentiate if you have a bug in your code or it's a bug in SwiftData's data sharing. This picture is an example on how to set it up: https://twitter.com/FloWritesCode/status/1668287882711412736 If you haven't watched WWDC videos already you should before starting: Another examples: https://medium.com/@priya_talreja/swiftdata-in-swiftui-part-1-18919ce2612 https://medium.com/@priya_talreja/swiftdata-in-swiftui-part-2-7a17b06a328a |
|
@Hatsushira after looking over all the documentation, and also Migrating from the Observable Object protocol to the Observable macro I'm even more confused about what Swift Data even means in my context. From what I understand, Swift Data allows data to persist as a sort of cache on the device that updates when changes occur from the user or server. So if I haven't been using Core Data, I assume Firebase has been doing that job in the background. But now that I want to replace Firebase, I'm at a loss for how Swift Data does whatever Firebase did. And I haven't even gotten to adding Cloudkit yet. I'm already getting mysterious errors in Swift Previews about 'Fatal Error in SchemaProperty.swift' when I try to add a modelContainer to my Content View. |
|
26 and 27 June 2023In the mean time, take a close look at @twoStraw's upcoming event: HackingWithSwift Live 2023! See -> Hacking WIth Swift Live 2023 The second day of this two day event, @twoStraws will deep dive into Because this is a live event, you'll most likely be able to field your tricky Buy your tickets now, and help his charity. All ticket sales support his charity. |
|
I look forward to Paul's explanation of Cloudkit integration. In the meantime, here is a video by Alfian explaining how he was able to get it to work. https://www.youtube.com/watch?v=Envpr8UAgYk |
|
I'm in the process of transitioning from Firebase to CloudKit for my event app. There are specific models/records that I want to share among multiple users. For instance, I want the Location model to be independent of any particular user, while the Event model should be owned by multiple users. On the other hand, the post model should be owned by a single user, and the Attendee model should describe details about a user's attendance. dailysportsupdates.com |
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's all new Paywall Editor allow you to remotely configure your paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.