You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we have XML something like <Array> <XMLMappable/> </Array>
and try to map it like var array = [XMLMappable]() array <- map[Array.XMLMappable]
we have empty array instead of array with 1 item.
If think problem method is mapArray(XMLObject: Any?) -> [N]? in Core/XMLMapper.swift
Suggest add else if statement like this.
Before: public func mapArray(XMLObject: Any?) -> [N]? { if let XMLArray = XMLObject as? [[String: Any]] { return mapArray(XMLArray: XMLArray) } return nil }
After: public func mapArray(XMLObject: Any?) -> [N]? { if let XMLArray = XMLObject as? [[String: Any]] { return mapArray(XMLArray: XMLArray) } else if let object = XMLObject as? [String: Any] { return mapArray(XMLArray: [object]) } return nil }
The text was updated successfully, but these errors were encountered:
Yes, this is an issue (already referenced in #3 although closed)
This will be fixed in the next release, as soon as I find a little bit of time to test it.
Thank you for your suggestion.
If we have XML something like
<Array>
<XMLMappable/>
</Array>
and try to map it like
var array = [XMLMappable]()
array <- map[Array.XMLMappable]
we have empty array instead of array with 1 item.
If think problem method is mapArray(XMLObject: Any?) -> [N]? in Core/XMLMapper.swift
Suggest add else if statement like this.
Before:
public func mapArray(XMLObject: Any?) -> [N]? {
if let XMLArray = XMLObject as? [[String: Any]] {
return mapArray(XMLArray: XMLArray)
}
return nil
}
After:
public func mapArray(XMLObject: Any?) -> [N]? {
if let XMLArray = XMLObject as? [[String: Any]] {
return mapArray(XMLArray: XMLArray)
} else if let object = XMLObject as? [String: Any] {
return mapArray(XMLArray: [object])
}
return nil
}
The text was updated successfully, but these errors were encountered: