Our first iOS app

We just launched our first iOS app: TravisCI! It lets you browse and view live updates of builds submitted to Travis-CI.org.

We chose to build a native front end to Travis CI in order to hone our iOS skills while working with a RESTful API. During development, we came across many neat libraries and tools we’d like to share with you:

RestKit

The first library we used is RestKit. RestKit enables any iOS/OSX application to interact seamlessly with a restful web-service’s resources. Once the appropriate object mappings are defined, a simple call, such as the one below, asynchronously fetches the repository objects from Travis, parses the returned JSON and saves them to core data using a pre-defined mapping.

RKObjectManager *manager = [RKObjectManager sharedManager];
RKObjectMapping *mapping = [manager.mappingProvider objectMappingForKeyPath:@"BWCDRepository"];
[manager loadObjectsAtResourcePath:@"/repositories.json"
                    objectMapping:mapping
                         delegate:nil]

Used in conjunction with a fetched results controller we could easily store and display resources from Travis’s Restful API.

This only highlights part of RestKit’s awesomeness. In addition to getting resources from a RESTful API. RestKit can update them just as easily.

libPusher

Travis CI service relies heavily on Pusher to relay updates about newly started build statuses back to the user. Thanks to libPusher we can register to receive the same pusher notifications in our mobile application. The libPusher library provides a callback mechanism to trigger your code when libPusher receives a notification… all we had to do is map the notification’s data to a coredata object and save it. Once again, with RestKit’s object mapper, this couldn’t be easier. And since our fetched results controller monitors for changes in the database, the view simply updates itself!

Container View Controllers

A neat new trick in iOS 5 is the ability to nest View Controllers in a container view controller. A Container view controller is a regular old view controller that you add children view controllers to by calling addChildViewController:. You may then directly add your child view controller’s views as subviews, or call transitionFromViewController:toViewController:duration:options:animations:completion: to transition between them. This is how we display the detail (main) view, and two tableviews side-by-side on the iPad.

TestFlightApp

TestFlight isn’t a library, it’s a lifestyle. Testflight lets us distribute beta builds to the Travis CI core team during active development. It provides a great user experience for your app’s stakeholders and testers. Getting a user signed up is as simple as sending them an email they open on their device. After a short provisioning dance, mostly invisible to the beta tester, the developers can make new beta versions available. Once configured, users can install new beta versions with just three taps! This tool is pivotal for getting feedback from busy stakeholders and testers.

Conclusion

We’re very happy with how TravisCI.app turned out, and we look forward to adding new enhancements during our company’s weekly growth days (think Google’s 20% time). A special thanks to all the beta testers for providing feedback!


Category: Development
Tags: iOS, Mobile