3 ms·
Seems like decent advice but perhaps pretty library specific. The only thing I'd argue with is: "Use semantic objects for parameters". I haven't had any troub
by joe_the_user 14y ago
Seems like decent advice but perhaps pretty library specific.
The only thing I'd argue with is: "Use semantic objects for parameters".
I haven't had any trouble passing a null pointer and casting it. Your API is going to be expanding regularly and the more message-passing objects you create, the more message passing objects' definitions you'll have to expand as the API expands.
- saddino 14y agoThe best approach I've seen for expanding APIs in iOS is the one Apple tends to use: pass a single NSDictionary of keyed parameter values. The API parameter list never has to change, it's guaranteed to be backwards compatible and you can still enforce use of semantic objects as the allowed values for the new keys you are adding. (It just struck me that this mirrors the approach Apple used often in Mac Toolbox: passing parameter structs with a version field, instead of modifying the API parameter list itself).