5 Awesome Things About RubyMotion

Last week HipByte released RubyMotion and although I was originally skeptical, I’m now fully on board. I wouldn’t consider myself an Objective-C developer over, lets say, a Ruby developer or C# developer. I’m simply a developer that likes to learn. When a client brought in an idea that needed an iOS app, I wrote it in Objective-C with Xcode like a good boy. The size of the app made it perfect to rewrite in RubyMotion which gave me a chance to compare and contrast.

1. Bridging the gap!

Bridging between Ruby and Objective-C methods is nearly seamless. We can call [NSString +stringByDeletingPathExtension] on a string we’ve created with the normal ruby syntax.

str = "index.html"
if str.stringByDeletingPathExtension == "index"
  puts "found the index"

2. Less is more...

No more ugly and long NSDictionary allocation syntax. RubyMotion treats ruby hashes as NSDictionaries.

NSDictionary *rules = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber NumberWithBool:TRUE],"RubyMotionIsAwesome",nil];

can be simply rewritten as

rules = { RubyMotionIsAwesome => 1 }

3. What is that parameter for?

Named parameters. I don’t know why all languages don’t include these. They are tremendously helpful for readability.

self.navigationController.pushViewController(view_controller, animated:true)

4. Add dependencies

You can add project dependancies quickly. Just add the frameworks name to the dependency array in the projects rakefile.

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = 'TestProject'
  app.frameworks << "AVFoundation"

5. Deployment

Deploying your app with TestFlight to beta testers is streamlined with the addition of the motion-testflight gem. Instructions on setting it up can be found at the RubyMotion page by following this link

Once you have it setup, its super easy to deploy to TestFlight

rake testflight note="a new revision"

We’ve already got plans to expand our use of RubyMotion in the near future. Being primarily a Ruby shop, RubyMotion means the ability to pair even if one isn’t comfortable with Objective-C and thats the biggest win of all.

Photo of Tim Bugai

Programming since the age of 8, Tim has a strong background in agile software development, Ruby, JavaScript, and iOS. He’s also helping our team with mobile application development, often leading the charge.


Post a Comment

(optional — will be included as a link.)
  1. So yes, its awesomesauce, has sweet syntax, easy dependency listing, and a REPL (http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) .
    But is it a valid choice for a production application? Unit tests, UI Automation, integration with apple profiler tools and debugger, consistent updates with Apple iOS updates.  These are the reasons why most professional iOS devs won’t be immediately switching to Ruby Motion.

    May 11, 2012 at 22:25 PM
  2. @Christopher Truman

    I think your stating the obvious here, the product is only a week old.

    Come to the dark side…Luke

    May 12, 2012 at 3:54 AM