Experiments in Cocoa #1 RadioAunty
posted by Duncan at 9:47 pm on December 12th, 2008[UPDATE] I’ve updated the app to now use the new higher quality live streams. Yay, no more RealPlayer for the majority.
I’ve seem to have spent a lot of time reading about Cocoa without actually building anything of substance. So to put a change to that I have built RadioAunty.
1. RadioAunty – This is a Cocoa Application that lets you listen to the radio, BBC radio, on your desktop. You can view the current schedule and select listen again shows, as well as simply changing the station via the menu bar and via the Dock. You can also set preferences to decide which should be your default Station to start with, and whether you would like to receive updates to the application when they are available (very important). If you have listened to BBC radio via Safari, then RadioAunty should work just fine for you.
Download RadioAunty from it’s project site

There are now many *.frameworks that come as part of the Apple Developer Tools and I found it pretty daunting to start with. So to make life easier for myself, I decided to start small and build bigger as I go along. This is why I started with the simple idea of RadioAunty. Oh and it’s Leopard only because it seemed silly to have to learn old ways of doing things as well as new.
RadioAunty is at a high level not that complex. It basically embeds an already existing webpage into a desktop app. It seemed like an ideal starting point. Once I had got that working (Thanks Apple, it takes about 3 lines of code!), the next thing was to make use of other classes and functionality to actually learn something. The app as it stands uses only uses these Cocoa classes (I’ve left the boring ones out):
- WebView
- NSMenu
- NSProgressIndicator
- NSWindowController
- NSPropertyListSerialization
- NSUserDefaults
- NSBundle
- SUUpdater (Part of the wonderful Sparkle Framework)
I’ve used @property quite a lot (properties are a bit like Ruby :attr_accessor) to automagically create getter and setters. I have also use key-value bindings, which once I understood them were amazing, and allow you to chop huge chunks of code from your source. I use a stations.plist to store the radio station data, but hope to pull that from the web in the future, meaning that it could play any radio station and not just the BBC’s. I also use delegation a lot whenever I can.
As I only started the app on Tuesday, I’ll continue making it more polished, that and I have a few other ideas, but I wanted to get something out for people to use as quickly as possible, so first main thing to add (apart from the radio) was auto-updating. This is taken care of by Sparkle 1.5b6.
Sparkle was super simple to implement. Their wiki documentation worked great, and I was amazed that something I always think is cool, and take for granted was so smooth to implement in this application. If you’re building OSX applications then this should surely be a must.
I have a few other projects in the pipeline, that incorporate more frameworks for me to learn, so stay posted. I’m progressing well with is an app called LeaveFrom, that does what is says on the tin really. It uses Core-Data which again had a bit of a learning curve, but I’m getting on ok. Can my old brain take all this new fun information.







