I am trying to map the json to model in Swift using JSONModel.
Everything works if model doesn't have properties that are JSONModel subclasses.
So in example this works, and it maps the properties successfully:
class Person: JSONModel {
var name: NSString?
var gender: NSString?
}
But if I put JSONModel subclass City, this property is not initialized, and it crashes the app when I try to access the city property later (I can successfully access person.name, and person.gender, but on person.city it crashes without any info):
class Person: JSONModel {
var name: NSString?
var gender: NSString?
var city: City? // City is JSONModel subclass
}
It looks like JSONModel cannot map/parse property if it is a JSONModel subclass. Did anyone experienced this and solved it?