On May 24, 2011, at 8:25 AM, Tito Ciuro wrote:

> I have a question about Cocoa API design. I think I can give a concrete 
> example to best explain what the goal is. Assume I have an Inventory service 
> and I need to write a client API that deals with it. Goals:
> 
> - The API should allow me to add, update, delete and search items
> - These operations should be asynchronous


- (void)addInventoryItem:(Item *)item resultHandler:(void (^)(NSError * 
error))resultHandler;

In this way, the result handling block already has access to every parameter 
and the receiver, so there's no need for verbose delegate methods which pass 
them all back, or packing and and unpacking an object which contains them all.


--
Seth Willits



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to