OpenFlow: a CoverFlow API replacement for the iPhone

When I released my first iPhone app, Presenter, two months ago, Apple accused me of using their private iPhone CoverFlow API. After appealing to Apple & writing a blog post about my roadblock, Apple reversed their decision.

Today at iPhoneDevCamp, I am releasing OpenFlow–a free, open source replacement for Apple’s private CoverFlow API. The initial release is simple, but it is also efficient and very fast, even on first generation iPhones.

Go get the code here:

The API should be easy to include in your own program. The main class, AFOpenFlowView, is a subclass of UIView.
To use this in your own project:

  • Add the OpenFlow source code to your project.
  • Add the QuartzCore and CoreGraphics frameworks.
  • Import “AFOpenFlowView.h” & interact with it as you would a normal UIView.
  • You should implement both the AFOpenFlowViewDelegate and AFOpenFlowViewDataSource protocols.

Currently, the delegate protocol is used to let your code know when the user selected a new object. The datasource protocol is called when AFOpenFlowView needs a UIImage object. This method should be *fast*. Don’t do NSURL requests or even disk access in this method. See the AFOpenFlowDemo app I provided for an example how to load images from a remote server. The datasource also needs to provide a default UIImage.

At any point, you can set UIImage‘s on your AFOpenFlowView. You don’t need to wait for the datasource protocol to ask you. Your AFOpenFlowView will start displaying images as soon as you call setNumberOfImages.

OpenFlow Demo

This is an initial release of OpenFlow. I licensed it under the liberal MIT open source license.
Please drop me a line to let me know what you think & where you want the project to go from here.

The source code for both OpenFlow and the AFOpenFlowDemo project are currently available as a zip files, hosted locally. For the demo application, you will need to register for a Flickr API key and secret. If you try to compile the demo, you will quickly find the error message where your Key & Secret should be added.

I will be moving this code to an online repository in the very near future.


About this entry