0

I am using JSONModel for creation of complex data models. I have recently migrated to swift and face difficulties during parsing an array of custom data models.

class ABCDomain: JSONModel
{
var sampleBool : Bool!
var sampleArray : Array <XYZDomain>!
}

After parsing, when i access the sampleArray i get the message as "fatal error: NSArray element failed to match the Swift Array Element type".

In Objective C, we would be creating a protocol as well for the XYZDomain, while in Swift a compiler error stating redeclaration is thrown. @property (strong, nonatomic) NSArray* sampleArray;

Primitive data type like Bool as well always appears as nil in the datamodel Please let me know if there is any workaround for this.

vivin
  • 992
  • 1
  • 8
  • 24

1 Answers1

0

I have found this as a good alternative. https://github.com/Hearst-DD/ObjectMapper

I have been using this for a while and don't have a problem with it.

vivin
  • 992
  • 1
  • 8
  • 24