Optionally use iCloud with SwiftData

How do I make iCloud optional when using SwiftData? Not all users will have an iCloud account, or allow my app to use iCloud. I want it to gracefully, silently use a local store instead of iCloud if iCloud isn't available. It should also silently handle when the user switches iCloud on or off.

Answered by LogicalLight in 764266022

My trouble was stale cache in the simulator or Mac. Restarting/rebooting a couple times helped.

Accepted Answer

My trouble was stale cache in the simulator or Mac. Restarting/rebooting a couple times helped.

Optionally use iCloud with SwiftData
 
 
Q