array of dictionaries JSON response
Not sure if I'm doing something wrong, but I have a request whose response is a simple array of dictionaries and it fails to map. I have resolved this by adding a line to ApiForm.swift (line 286):
if let arrayData = data as? [AnyObject] { return arrayData }
but I'm not sure if this is correct. Without this it's always trying to handle the response as a dictionary so it fails out.
Excellent find! Do you think you could make a pull request with this? I can help you by writing a test when it's up.
I made quite a few changes while playing around to see how much i liked realm. You made some other similar changes around the same time but implemented in a different way and I didn't spend time to resolve the conflicts. Since then I haven't been using realm at all, hence no PR. This specific change is literally:
private class func arrayFromResponseForNamespace(data: AnyObject, namespace: String) -> [AnyObject]? {
if let arrayData = data as? [AnyObject] { return arrayData }
return (data[namespace] as? [AnyObject]) ?? (data[namespace.pluralize()] as? [AnyObject])
}
(I made other changes related to response status codes, foreign key model transform + tests, ISO8601 date transform formats + tests that I can tell you about if you're interested)