News

 
  • 18 Sep

    RubyMotion Success Story: Frontback

    Frontback was launched in early August and distinguished itself immediately among a sea of camera apps. Frontback is unique in that it includes the photographer in all the photos.

    Frontback got an excellent coverage in the tech press since its launch: TechCrunch, The Verge, CNET, The Next Web, and many more. It was also featured on Bloomberg TV and users of the app include Twitter creator Jack Dorsey and prime minister of Belgium Elio Di Rupo.

    The app is excellent, and was lovingly built using RubyMotion. We had a chance to hear how its creator, Melvyn Hills, created the app. Melvyn lives in Brussels. He helped create Checkthis using Ruby-on-Rails, Slim, CoffeeScript, and Sass after leaving the world of Flash/ActionScript. Like many programmers, he got his start on a programmable calculator (a CASIO, if you must know).

    What was the inspiration to create Frontback?

    3 months ago, Frédéric did a post on Checkthis app with two pics, one with the front camera & one with the back, with only a “Front Back” title. On that weekend there were dozens of other “Front Back” posts, and a lot still afterwards. This made us think about a simpler product for just that purpose: me & what I see, right now. The Selfie with an excuse.

    You take the first picture in front of you in the first top half of the screen, then one at the back of your phone: you. Then you select your current location, choose where to share it and that’s it. By connecting your 3rd party social networks, you auto-follow all your friends on Frontback and can browse a feed with their frontback posts and some staff-picks.

    What made you decide to use RubyMotion?

    We wanted to build a quick prototype, so I first did a bit of research about whether it was doable with Web technologies on iOS… but no :) I already had heard a lot about RubyMotion through Yannick Schutz & Laurent Sansonetti and even went to the awesome #inspect conference in Brussels, and I have a bit of experience with Ruby (none with Obj-C/iOS) so I thought about giving RubyMotion a shot. After a few days, I enjoyed it so much, it was so easy to get on tracks simply by reading the iOS APIs docs, it was very clear for me that I was going to build the whole app with RubyMotion. I really felt at home with my AS3 & CoffeeScript background.

    So you came to iOS development from a frontend-web background. What were some of your early challenges?

    The main challenge I had to deal with was memory/cache management & performance for many pictures. Our app consists mainly of an infinite feed of full-screen pictures. I had to deal with async infinite loading, image download & decompression in a background thread to keep iOS users happy with their beloved 60fps smooth scrolling they’re so used to. I finally ended up using BubbleWrap HTTP module with a custom NSCache wrapper with disk caching fallback. At first I used a UITableView, but I needed more than two cells (automatically handled by UITableView) so I used a paginated UIScrollView with a custom cell-pooling technique.

    Once you had a better grasp of the framework, what helped you be the most productive?

    Other than Apple’s iOS documentation & StackOverflow, BubbleWrap was a great help for many things such as HTTP, Pub/Sub, JSON, Location, timers,…

    Mattt Thompson's libs and blog helped a lot too. AFNetworking (but later switched to BubbleWrap), AFUrbanAirshipClient, …

    Reveal app is a great tool to debug your views. And CocoaPods is awesome, I used much more pods than gems actually.

    What would you say to someone who was trying to choose between RubyMotion and traditional iOS development?

    With RubyMotion, it’s easier to get on board. Every line you write is needed application logic, nothing more. It’s cleaner & easier to read & write, especially if you come from a Ruby/Python/CoffeeScript background. The fact you don’t have to use XCode is a big win. For debugging, however, it’s a bit more difficult. Dealing with GDB isn’t easy. I’m trying RubyMine right now, it seems to help.

    What lessons did you learn from building Frontback? In other words, what will you do differently when you go to build your next app?

    I’m quite happy with our codebase & overall quality of the app. I’d probably abstract some of basic & repeating functionalities. I’d also might use some view layout/styling abstraction like Teacup. I didn’t use it this time because I wanted to first really understand how layout & view management works on iOS. Our app is visually simple & has a clean flat design, so it wasn’t too much of a hassle to code by hand.

    If you had one request for the HipByte team, what would it be?

    Write a thorough article about threads & GCD with RubyMotion. And another about memory management: how to properly cache stuff, release objects & handle memory leaks. These are the most difficult topics I think, coming from a web development background.

    The new version of your app brings lots of new features. It was even featured in Bloomberg TV! How difficult was it to add these features to an existing code base? Did you have to plan for these features, or was it easy to add them on as needed?

    Yes indeed, the app is getting some pretty good coverage and momentum right now. The new version brings many new features to add a real social layer: likers view, profile view, followers/following view, friends finder and a single post view, all navigable from one to another.

    We didn’t plan everything from the beginning, as we first observed our user base usage of the app before deciding what was the next features we wanted to add. We didn’t encounter any problem for adding those features into the existing codebase, which was already quite well decoupled and structured. The nice thing I like about Ruby, compared to Obj-C, is that the codebase remains smaller and cleaner: no header file for each implementation (half the number of files!), smaller lines, methods and classes. This makes code refactoring much easier.

    The biggest change I had to do was to handle global navigation throughout the app: how the UINavigationControllers handle the horizontal browsing, combined with the different sections that can be presented modally. I ended up with a pretty nice base class for my UIViewControllers with some simple methods to navigate everywhere in the app, using global notifications transparently under the hood.

 
 

Want to stay in touch?

Follow us on Twitter