Swiftui - Syncing @AppStorage data with iCloud

882 Views Asked by At

I have a test iPhone app where user has scores that keep updating. Currently I use @AppStorage and that works great. Issue is, if I create iPad app the data won't sync.

I tried NSUbiquitiousKeyValueStore, but it's too slow. Scores don't update instantly even on Local storage.

Is there anything that I keep using @AppStorage and some logic sync data in background with iCloud, so if the person downloads app on another device, data can be synced?

Or some another solution instead of NSUbiquitiousKeyValueStore or @AppStorage.

1

There are 1 best solutions below

0
ASCIImo On

If you plan to store only small amounts of data, like a double value or an array, you should consider NSUbiquitousKeyValueStore. It's surely much easier to set up than CoreData, which is used for potentially large amounts of data.