قالب وردپرس درنا توس
Home / IOS Development / Save dictionary to core data: iOSProgramming

Save dictionary to core data: iOSProgramming



Hello folks,

New to iOS, now trying to learn to save data to Core Data.

So i ping an API and returns a JSON object and I can convert the JSON object to instances of my structures, the part I have no problems with.

Then I realized that I was going to create mirrored objects within CoreData, so I've set up all my attributes for their corresponding type.

Now most of them are ints and strings, which I have no trouble saving, but others are dictionaries ([String: String] in struct). I have defined these attributes to have a transformable type using NSDictionary.

When I try to save the dictionaries and print them to check, are they converted into a single string for some reason?

Can anyone explain what I'm doing wrong here and if there is a better approach to this?


Source link