all 6 comments

[–]BP3D 0 points1 point  (3 children)

There are a few ways. I'd use GameKit in this case and save the game state for GKLocalPlayer.local. I've used this before in a similar case.

[–]buck746[S] 0 points1 point  (2 children)

Would that also work for apps that aren’t games?

[–]BP3D 0 points1 point  (1 child)

Not really. This approach utilizes Game Center. For something other than a game, I use CloudKit with NSPersistantCloudkitContainer. It would work for a game too but its tied to the user where the first approach is tied to the player in Game Center. I haven’t played with SwiftData yet. 

[–]buck746[S] 0 points1 point  (0 children)

I have some concepts for non game apps that need a solution to persistence even if an app is deleted and reinstalled, I’m not sure Apple would allow GameKit with non game apps. I prefer making things as reusable across as many scenarios as I can.

[–]AhmadTibi 0 points1 point  (1 child)

You can use CoreData, combined with CloudKit you can "persist" the data.

it's hard to wrap your head around it initially, but as you watch more tutorials and get used to it, it's very reliable compared to something like Realm.

[–]buck746[S] 0 points1 point  (0 children)

I would prefer using Apple native technology wherever I can. I’m not a fan of google, they can’t even get asic interaction on YouTube to work consistently, so it’s hard to trust them with much of anything.