Moving a Mac App: Viewfinder for iPad

Viewfinder for iPad shipped a couple of weeks ago. It's been insanely busy since then but I finally found some time to reflect on the process of moving a Mac OS X application to iPad.

Mission Statement

In most talks you hear from Apple employees about designing for iPhone and iPad, they always suggest that you develop a 'mission statement' for your app. On Mac OS X, Viewfinder's mission statement was simply:

Easy photo search and download for Mac OS X

For the iPad version, that statement was radically overhauled to say:

Easy photo search and download for iPad

The entire point of Viewfinder has always been to solve the problem that it's way too hard to find and use good quality, correctly-licensed photos on the internet.

Translation

When moving an application or its general concept to iPhone, the rule has always been "find the core functionality and translate that to the iPhone". It's still true of the iPad but the difference is that the iPad increased processing power and screen size invites you to bring a much larger feature set.

As I was working on bringing the core functionality of Viewfinder to the iPad, I took a three-step approach:

  • Eliminate the features that are impossible to translate
  • Simplify the features that can be done, but in a reduced manner
  • Focus on a polished, native experience for the rest

Eliminate the Impossible

As it stands, Viewfinder on Mac OS X is a fairly tightly focused application. It doesn't contain a lot of superfluous features, but there were a few features that couldn't be brought to iPad because of the limitations of the iOS platform.

Viewfinder on Mac OS X can automatically add a downloaded photo to the current Keynote document. This feature is implemented on Mac OS X using Automator, which doesn't exist on iOS, so it couldn't be brought over. There's no equivalent cross-application automation technology on iOS, so it had to go.

Similarly, the feature that allows Viewfinder to set the Mac OS X desktop picture directly is also not possible on the iPad. There's simply no API to do this on iOS. Gone.

Finally, Viewfinder supports a "Search in Viewfinder" service on Mac OS X. As with the other features, Mac OS X services have no analogue on iOS so the feature had to go.

Similar but Simpler

Developing for iOS devices is developing a highly resource-starved environment. Many fewer, slower processor cores; slower graphics hardware, dramatically less RAM and, on 3G, much slower and less reliable networking. I find it a source of constant wonder that we squeeze the performance that we do out of these devices, and often wonder why Mac OS X machines feel so slow by comparison.

Viewfinder is an application designed to show large numbers of photos. Without care, this is potentially a difficult thing to do. Photos are some of the largest data blobs an iOS app will handle, so it's important to manage that precious memory carefully.

On the Mac, Viewfinder has a dynamically-resizable thumbnail view. It responds to the user's intention by automatically loading ever-higher resolution images as the thumbnails grow. The internal architecture of this feature is something I'm really proud of, and I think it's a great feature.

The idea of transparently hitting the network for ever larger images doesn't translate well to the iPad. Particularly in this new world of mobile data caps which are "unlimited*" - the asterisk being the international symbol for "if you take this literally you're a sucker" - being more conservative with data usage is important.

So, for Viewfinder on the iPad, I built a thumbnail view with similar core functionality only simpler. The thumbnails are fixed at a maximum width or height of 100px and, instead of zooming them to a larger size, you enter a full-screen mode similar to the built-in Photos application.

Another feature that I personally love in Viewfinder for Mac OS X is the ability to filter the search results by the size of the largest available version. This is a really important feature on the desktop, where you may be looking for photos to fill a 27" display or a high-resolution document.

On the iPad, I decided to leave this feature out. I left it out for two reasons. One is that using the original full-size image on the iPad is often difficult because of the incredibly large file size that some modern DSLRs produce. Secondly, you don't need a massively high-resolution image for most purposes on the iPad. The screen is only 1024x768. Viewfinder still supports searching by the full range of Creative Commons licenses.

Polish The Rest

So, what's left in Viewfinder? There are a core set of tasks that make the application:

  • Set search options
  • Begin a Search
  • View a set of thumbnails
  • View a larger size
  • Download photos
  • Inspect and copy information about the photo

Too many iOS applications aspire to "brand" themselves. It's sometimes appropriate, of course, but I took my inspiration from two system apps that Apple provides: Safari and Maps.

The thing I most love about Maps is that there is almost no UI. It's an incredibly powerful application that delivers everything through a small number of UI elements:

  • A toolbar with two buttons and a search field (two fields in Directions mode).
  • A popover with details about locations
  • A page-curl view to set options
  • An alternate full-screen UI for Street View

The rest of the display in Maps is given over to the main function - showing a map. Viewfinder endeavours to be similarly minimalist.

Not the iPhone

The typical approach to bringing an application to the iPhone was really three steps:

  • Identify the core functionality of the app
  • Remove everything else that isn't essential
  • Polish the user experience

I think the iPad is different. I've written before that I believe the iPad is a true productivity platform and not just the "content consumption" toy that some lazily claim.

Instead of looking for some kind of barebones set of core functionality, I decided to see how much of the desktop app I could bring to the iPhone. I'm delighted with the result and I encourage my fellow developers to push the iPad as far as it can go.

For the rest of you, why not visit the App Store and check out Viewfinder for iPad?

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: