Bacondrop uses two third party libraries that are quite good.
The first is ChocTop, Dr Nic’s library for generating DMGs and managing Sparkle. The documentation is great and the gem is dead simple to use: all I had to do was run
rake dmg (after installing it and running
install_choctop path/to/project) to get a DMG ready for distribution. It even included an
Applications shortcut in the DMG for easier installation. Though Bacondrop doesn’t use Sparkle, I already know I’ll use ChocTop in any and all Cocoa apps I write in the future.
The second library is ASIHTTPRequest. It’s an Objective-C wrapper for the CFNetwork API which makes it dead simple to issue HTTP requests. The file uploading support in particular is ridiculously good:
def beginUpload(url, path, username, password) request = ASIFormDataRequest.requestWithURL(url) request.username = username request.password = password request.uploadProgressDelegate = progressBar request.didFinishSelector = "uploadFinished:" request.didFailSelector = "uploadFinished:" request.setFile(path, forKey:"file") @networkQueue.addOperation(request) @networkQueue.go end
This’ll POST a file to the url of my choosing, authenticate with HTTP basic auth, hit the
uploadFinished: method with the request object upon completion, and even update a progress bar for me along the way. Naturally it’s all done asynchronously – I can fire off as many as I want using the queue.
(It’s not the exact code I use in Bacondrop, but it gives you an idea of how easy it is to use this library.)
The documentation is fantastic and it even works on the iPhone. Ben Copsey really knocked this one out of the park.