If I write a framework that gets information from the Internet, should I make a degelate or use blocks?

Posted by Time Machine on Stack Overflow See other posts from Stack Overflow or by Time Machine
Published on 2011-01-15T00:46:37Z Indexed on 2011/01/15 0:53 UTC
Read the original article Hit count: 119

Filed under:
|
|
|

Say I'm writing a publicly available framework for the Vimeo API. This framework needs to get information from the Internet. Because this can take some time, I need to use threadin to prevent the UI from hanging. Foundation uses delegates for this, like NSURLConnectionDelegate. However, Game Kit uses blocks as callback functions.

What is the recommended way of doing this? I know blocks aren't supported in standard GCC versions, but they require less, much less code for the one that uses my framework.

Delegates, on the other hand, are real methods and when protocols are used, I'm sure the methods are implemented.

Thanks.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about delegates