RubyMotion Ready for Mainstream?

278 views
Skip to first unread message

codemonkey

unread,
Oct 22, 2013, 11:41:44 AM10/22/13
to rubym...@googlegroups.com
Hi all,

We are starting to build our iOS apps on Rubymotion.  What are your thoughts about the stability of the community, and the product overall.  We are going to base our development efforts on RM for the near future.  Is this a safe bet?

Thanks!

Colin T.A. Gray

unread,
Oct 22, 2013, 12:33:27 PM10/22/13
to rubym...@googlegroups.com
You're coming in at a great time!  The community has always been great, in my opinion, and the compiler has improved a lot since it's release, these days it is very predictable and it will work for you out of the box.  I'll mention one particular quirk below.

Check out the "RubyMotion success stories" on the blog, you'll see that a lot of very successful apps are using RubyMotion, like BaseCamp, Frontback, Jukely, Cabify.

This list is the best place to get answers to RubyMotion questions, but you should also rely on Stack Exchange.  Usually, answers to Obj-C questions will also apply to RubyMotion.  If something is REALLY frustrating you, please email me or another HipByte employee directly (Eloy Durán, Joffrey Jaffeux, Shizuo Fujita aka Watson), we'll do our best to get your question answer or issue resolved.  The RubyMotion creator Laurent Sansonetti is also available, though I would ask that you talk to me or someone else first.

There are some popular gems you should check out, to see if you might find them useful:

- Promotion by Jamon Halmgren and Mark Rickert
- Formotion by Clay Allsopp
- BubbleWrap by Matt Aimonetti, Clay, and Marin Usalj
- Teacup by Conrad Irwin and myself
- SugarCube by myself and MANY people from this list
- Geomotion by Clay Allsopp and myself
- MotionModel by Steve Ross
- Futuristic by Mateus Armando

- ...what others am i forgetting?  there are lots of gems.  search for "motion" in rubygems, many of those are RubyMotion gems.

- plus the main CocoaPods developer, Eloy Durán, is a HipByte employee.  We can already include CocoaPods easily.


Now the cons!

At the moment, the biggest bug/quirk I know of is around blocks (not surprising; they are a complicated feature in ANY language).  Right now, if you retain a block, you immediately create a retain cycle that will NOT be detected by the cycle detector.  The reason is that the block keeps a reference to the object it was created in (this is a good thing; it allows callbacks to work correctly even when the object that created the callback has "gone away", like a view-controller that is no longer visible).

The only way out of the mess is to nil-ify the reference to the block.  The most common case is in a view controller, where you might have a block that is called by a button press (the 'SugarCube' gem introduces idioms to make this very easy, I'll demonstrate that here)

def button
  unless @button
    # a button at (0,0), width 100, height 20
    @button = UIButton.alloc.initWithFrame([[0, 0], [100, 20]])
    @button.setTitle('Push!', forState: UIControlStateNormal)
  end
  return @button
end

# this method is called from `viewWillAppear`
def attach_handlers
  # attach an 'on touch' handler
  @button.on :touch do
    self.tapped_a_button
  end
  @text_field.on :change do
    # and so on...
  end
end

The controller retains the view, the view retains the 'on-touch block', and the block retains the controller.  boo.  So when the controller is "going away", you need to detach the handler.

def dettach_handlers
  @button.off :touch
  @text_field.off
end

This will be resolved in a future version of the compiler, which come around every month or so (there are no set release dates, new versions are released when they are ready).


Ready for mainstream?  I vote yes!  I earn most of my bread as an iOS app developer, and I use RubyMotion exclusively.  I did both Xcode/RubyMotion for a while, but I got so sick of the Xcode workflow, I gave up on it.


So welcome!  :-D


Colin T.A. Gray
Community Manager
HipByte

codemonkey

unread,
Oct 22, 2013, 12:57:43 PM10/22/13
to rubym...@googlegroups.com
Awesome, great to hear.  Being a Ruby (Rails) shop we were hoping for a better entrance into Mobile than the XCode mess.  RubyMotion has been great, clean, and enjoyable to work with.

Thanks for the suggestions.  

GantMan

unread,
Oct 22, 2013, 3:00:42 PM10/22/13
to rubym...@googlegroups.com
As a fellow Rails developer, I can give you a big thumbs up with RubyMotion.  The community is younger than Rails, so you get to break new ground, but that comes with no herd to follow when you're lost.  Fortunately I've found the RM community comes to my aid quickly, and I try to pay that back in this Google group, any chance I get.  

I'd recommend ProMotion, sugarcube, and teacup to keep projects clean and closer to RoR standards.

codemonkey

unread,
Oct 22, 2013, 7:09:21 PM10/22/13
to rubym...@googlegroups.com
Great, that's what we need.  Good to hear.  I'm looking forward to it.

Mark Rickert

unread,
Oct 23, 2013, 6:47:55 PM10/23/13
to rubym...@googlegroups.com
Wow! Fantastic post, Colin!

codemonkey, I use RubyMotion for all my new apps and have even ported some existing apps over to rubymotion. IMHO, it makes releases easier and more bulletproof beucase of the superb testing framework and easy .ipa creation with "rake archive:distribution".

-Mark
Reply all
Reply to author
Forward
0 new messages