Use Core Data with Sprite Kit

1

I'm doing a game in Swift with SpriteKit, it happens that it does not give me the option to save the data with Core Data.

I am doing it by saving the data in a file, but since there are a lot of data my array is like this: [String : [[String:Any]] ] and it throws me the error:

Cast from 'NSArray?' to unrelated type '[String : [[String:Any]] ]' always fails

Even if I shrink the fix to something like this: [[String:Any]] throws me the same error.

Therefore I want to see if I can save the data in CoreData (although I have never used it, I only saw a tutorial) and if so, someone can guide me to see how to do it.

A thousand thanks

    
asked by albertcito 29.03.2016 в 21:51
source

2 answers

1

You have to bear in mind that using CoreData next to SpriteKit does not cause any problems since they are frameworks completely different than. To reduce the learning curve and implement it quickly and easily, I recommend you use MagicalRecord . The documentation is simple and with many examples.

Failing that, and if you want to learn a new type of storage  much faster and more modern than CoreData you can also use Realm.io which is also multiplatform.

    
answered by 30.03.2016 / 09:13
source
0

Integrate CoreData with the help of this tutorial (in English): link

    
answered by 28.04.2016 в 22:58