HealthKit SwiftData sync

Hello,

I want to build an app that will allow the user to entry some health related records and be synced with the HealthKit. Any record that is in the HealthKit is stored locally on the device.
I find it conceptually unsure if I should be storing the HealthKit records in the SwiftData to make the user records available across the iCloud synced devices.

Should I read the HealthKit record, make a copy of it (including it's ID) on my app's data in SwiftData? How the syncing should be done the right way?

thanks.

HealthKit data is already available on all a user's logged-in devices (see https://support.apple.com/guide/security/protecting-access-to-users-health-data-sec88be9900f/web), there should be no need for you to store & sync a copy of it, generally.

I’m also building a health app. How do I handle a situation where the user doesn’t want to grant Health access, but I want my app to be able to still function using local data via SwiftData? How would these two data stores coexist if the user later grants health access?

HealthKit SwiftData sync
 
 
Q