In the development of the data will inevitably encounter, the system returns the collection of dictionaries, the collection of a dictionary, and then a dictionary or a dictionary or a collection of complex structure data ... Mjextension easily fix this kind of problem
1. Workaround One:
Example: There is a model for the post data in the best project, there is a collection of the hottest comments in the model, the collection data requirements are chaoscomment model data, and then the Chaoscomment model has a user dictionary (Chaosuser model):
- Solution: Use Mjextension to implement the Mj_objectclassinarray method, and tell the model that this set property corresponds to its own model is OK
- Note: At that time, I just specified the above method, the user model in Chaoscomment did not implement this method, but the framework has helped me to do the processing!
Two. Another situation is that the data structure is also very complex, but in a deep, hidden dictionary, you only need one of the dictionary data. For this one key-value pair, it's a bit of a waste to get n multiple models out. Mjextension has helped us think about it.
2. Workaround Two::
Or, for a moment,:
iOS Development Tips-using mjextension to solve complex model transformations of data structures