gonzalezreal / Groot

From JSON to Core Data and back.
Other
534 stars 61 forks source link

Updates to NSPropertyDescription #78

Closed naqi closed 7 years ago

naqi commented 7 years ago

Xcode is a mess when editing userinfo in Data Model. I rather add userinfo only when it is needed than add for all properties. So it was easier to match the property names to our API response and add JSONKeyPath for those that didn't match. So the end results was that only id key needed to be updated on all models and some relationship keys.

Our API follows JSON-API standards so JSON can include links.users : [array_of_ids]. It meant I had to normalize the data after the response was received which was just a problem of big O. So instead I have added provisions in the code to allow JSONKeyPath to be a path to the object. So in our case users relationship has JSONKeyPath of links.users which means no more normalizing the data!