Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swiftui - Syncing @AppStorage data with iCloud

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.

like image 337
Sunny Avatar asked Dec 05 '25 18:12

Sunny


1 Answers

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.

like image 173
ASCIImo Avatar answered Dec 08 '25 20:12

ASCIImo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!