The other day on twitter I mused (i.e. complained):

iOS needs a block-based UIAlertView. So many currently-delegate based interfaces would be better served by block callbacks.

Being a man of action, Brian Cooke took the off-hand remark and ran with it, creating his RooAlertView block-based UIAlertView wrapper.

Inspired by Brian’s gift of source – and maybe just to keep this code-volley going – I’m putting up my own block-based NSURLConnection wrapper, JCDHTTPConnection.

JCDHTTPConnection is a pretty simple class that takes a NSURLRequest object and (up to) three block callbacks: onSuccess, onFailure, and onDidSendData. It’s asyncronous, of course, and much more convenient than setting up a delegate. I’m pretty happy with it, and I hope it might help someone out.

Get it at GitHub.

"JCDHTTPConnection" was originally published on 26 Nov 2011.