Hello
I have a generic question regarding best practices for my specific case.
I'm writing a biking application which is communicating with multiple sensors (speed, cadence, hr) + using the phone's gps. I'm saving every data entry into CoreData.
For example I have a workout object, with an uuid. Then when a sensor reading arrives, I'm creating a new entry for that reading, and saving the workoutID as a foreign key. So no relationships managed by CoreData.
Now I want to add CloudKit support to my app. My main concern is the amount of entries. Like I have a workout (a real one 🚴 🙂 ) where I biked for 12 hours. For that workout, I have 113k sensor reading entry, and around 90k GPS. In total just for that workout it is more than 200k entry. For CoreData it is working fine (reading time for this whole banch of data is around 4 sec), but I'm worrying about not to overwhelm CloudKit by creating entries. In theory it could work to serialise all the entries into a JSON with Codable, and save them under an attribute in the Workout object (ok, memory usage will be high I know), but I don't feel this as a nice solution.
So my question is how to deal with situations like this? Also is there a detailed description how to deal with CloudKit with CoreData? I mean for example the local cache is a bit fuzzy for me. Like should I store the data in the core data after the systemFields decode?