The Road to Viewfinder 1.0

I try not to write software that I know I won't use. I think you can always tell when a developer doesn't use their own stuff.

Back in August, I was producing a Keynote presentation for school (I'm a computing teacher in another life). I wanted to be scrupulous about using the correct Creative Commons licensing, but I also wanted great images and I needed large sizes. Flickr is, of course, the natural place to go for such needs.

So I clicked and searched and clicked and downloaded and reveal-in-Finder'ed and dragged and dropped and, in two hours, I had gathered a grand total of four images.

My heart yearned for an easier, faster way to do this. If only there was an app for that, I thought. I remembered that there was this guy who was pretty handy with the Flickr API and also not bad at Mac programming. Then I remembered that I was that guy.

So I got to work. I pulled out my trusty Flickr abstraction layer and hacked and hacked and hacked. My Git repository shows the first commit at 5pm on August 16th. In just longer than the time it takes to go around the world, Viewfinder 1.0 is launched to the world.

The Snow Leopard Dimension

I built Viewfinder for Snow Leopard. Back in August, that was a bit of a touch-and-go decision. However, looking back on it, I insist that the only reason I was able to ship so quickly was because of the API enhancements in Snow Leopard. I thought I would maybe discuss some specifics here.

Blocks

As a long-time Objective-C programmer, I'm wholly new to blocks. I knew about them in Ruby, but they didn't make sense to me until I saw them in my 'native environment', if you will.

Viewfinder is full of block code. A good example is the download manager. The basic operation is "download this photo", which happens when you double-click an image. The download method, however, takes a block which will be executed on successful completion of the download.

The "download and set desktop picture" and "download to Keynote" operations are simply the "download" operation with different post-download blocks attached. Lovely!

NSCollectionView

Some of the real hard-won knowledge in Viewfinder is around NSCollectionView. One great enhancement to the NSCollectionView API in Snow Leopard is the ability to constrain the view to a specific number of columns. Under Leopard, the view would tessellate the prototype views to any number of rows and columns.

Viewfinder's Downloads window is a single-column NSCollectionView. The trick is in how to get a button in an NSCollectionView template to act on the specific represented object for that row. Unlike the default Interface Builder setup, the prototype view is in its own XIB file. I think that probably deserves its own post.

Quick Look

Viewfinder supports Quick Look in the thumbnail browser without hackery. QuickLookUI.framework is public in Snow Leopard and not too difficult to use. I had a few problems with positioning the panel correctly - it seems that the Quick Look panel doesn't like to have its size fiddled with.

Desktop Pictures

One of my favourite features in Viewfinder is "download and set desktop picture". Under the ancien regime, this was possible through various levels of hackery. In Snow Leopard, it's one line of code.

Bookmark NSURLs

Snow Leopard extends NSURL to provide a lot more support for file: protocol URLs. In particular, the file reference URL concept allows Viewfinder to track downloaded photos, even if you move them on disk. File reference URLs are kind of like FSRefs - it's a path-independent pointer to a file.

Garbage Collection

Not a new thing in Snow Leopard, but Viewfinder is the first garbage-collected app I've worked on. It's been most enjoyable - no more EXC_BAD_ACCESS!

Nice Things

Lots of people were kind enough to tweet and blog about Viewfinder on its launch. Here are some of my favourites:

  • @manton: "Happy for @fraserspeirs that Viewfinder is on Apple's downloads front page. What a solid launch."
  • @ids: "Viewfinder is going to save me loads of time. Keynote integration FTW."
  • @benr75: "OVERLY impressed with Viewfinder! Great work!"
  • @rquat: "amazing work. Viewfinder is what Flickr search should have been."
  • @danielpunkass: "My friend @fraserspeirs announces Viewfinder 1.0, expanding his Flickr-related software empire ;)"
  • @kevinhoctor: "And now I'm playing with @viewfinderapp from @fraserspeirs. You people are killing me with your cool software releases!"
  • @raminf: "Congrats on @viewfinderapp release. Would've been terribly handy last week when I spent eons searching CC images."
  • @fahrni: "Another great application for Flickr lovers and photographers."
  • @drbarnard: "awesome new OSX app for searching and using Flickr images"
  • @smerp: "Is that your voice on the screencasts? If so, you should totally say "There can be only one!" on the next one you make."
  • @gordonhughes: "Just spotted some of the #paddyinvasion at #wwdc using @fraserspeirs' @viewfinderapp. There's even a shot or two of me in my kilt!"

Viewfinder also got some nice write-ups by: