The question is quite simple: When I create a new API or Service Class should I create a custom class for the objects that are being passed around or should I just stick to an NSDictionary
which simply holds the data in a key-value-style format.
Obviously there are pros and cons but where do you guys think is the threshold of using one over the other?
NSDictionary
:
+
No dependencies
+
Very Flexible
+
Commonly used
+
Build-in support for NSCoding
-
Structure not defined -> Runtime errors
A custom Object:
+
Structure defined
+
Property-style accessors: myObject.someProperty
-
Can result in a rel. big number of classes for nested objects
Update: Included remarks from jbat100