I'm trying to save a nested Map in Swift, and it's not working as expected. The Map structure looks something like this:
[
"racesMap": [
32904: "Races(bestTime: 1, bonusRanking: 0, countryID: 0, ...)",
32905: "Races(bestTime: 1, bonusRanking: 0, countryID: 0, ...)",
],
"userName": "Alpha",
]
let inputMap: [String: Any] = above map
defaults.set(inputMap, forKey: "keyFormapSaving")
Saving username works, but encountering an error when attempting to save the "racesMap" key. Seeking assistance to identify and resolve the issue.
Error by XCODE:
Thread 1: "Attempt to insert non-property list object {\n
32904 = "app.Races(bestTime: 1, bonusRanking: 0, countryID: 0)";\n} for key keyFormapSaving"
Thanks @Joakim Danielson I've achived it by just converting the model class to Data object and reverse it for getting