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 ...

Get RubyMotion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.