O'Reilly logo

RubyMotion by Clay Allsopp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exploring RubyMotion Libraries

We whipped up a pretty interesting app using a relatively small amount of code; however, we also used some vestigial Objective-C patterns that look obviously out of place. This is one area where the RubyMotion community is stepping up and wrapping un-Ruby code into more idiomatic structures. Several libraries and RubyGems[11] are available that could have helped us manage our views.

For example, Sugarcube (https://github.com/rubymotion/sugarcube) would have allowed us to replace those long animation method names with very concise functions such as fade_out and move_to.

 last_view.fade_out { |view|
  last_view.removeFromSuperview
 }
 
 other_views.each ​do​ |view|
  new_origin = [
  view.frame.origin.x,
  view.frame.origin.y ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required