The RubyMotion Way
clayallsopp.com
clayallsopp.com
I politely disagree. Objective-C hasn't been missing risky and error-prone approaches that merely attempt to save a few characters at the cost of correctness. Extensions like 'when' are vague, and could just as easily be co-opted for KVO as they could for UIControl event handling.
Also, the example is not accurate. In Objective-C, you'd control-drag from the button to your action method, using Interface Builder.
TBH I think it really is a matter of preference at this point. There could be a killer, must-use RubyMotion framework in the future, but for now I simply feel more productive and flexible in Ruby.
In fact, the most impactful change of RubyMotion (and I somehow neglected this when I wrote it) is testing. It ships with a really powerful port of Bacon which is lightyears better than UIAutomation, KIF, and every other iOS testing framework I've tried. `rake spec` is a seamless, regular part of my workflow in a way that Xcode failed to achieve.
With Interface Builder, there is no "right there in-line with the button", because the button (and the entire remainder of the layout) is instantiated and fully laid out in a nice WYSIWYG editor.
That said, as the you noted, you can do this in Objective-C. However, due to the propensity for conflicts, it's bad form to insert un-prefixed category methods into system classes.
This is an appeal to emotion, but I must be honest: I'm concerned about the day that I'm asked to take over maintenance of a Ruby Motion project, especially if it's likely to diverge significantly and arbitrarily from our community's existing best practices.
Can RubyMotion itself be used to create Mac apps in addition to iOS apps?
RM and MR are both by Laurent Sansonetti, and the experience developing for them is identical. The Ruby code is just as portable as Objective-C between iOS and OS X. I'm working on something right now which uses both technologies and it's been a great experience.
I think this is a shame, because I suspect lots of people would quite like to contribute back to the project, and that's currently not an option.
I'm perfectly ok with paying a fee to get RM but I know that wouldn't pay for support (especially if the community handles it which is already the case).
Corporate sponsorship doesn't always works and often lacks security and stability for both the developer and the project as they are at the mercy of one entity.
I suspect that the number of people who would actually be interested in (or, indeed, even capable of) contributing back to the parts of RubyMotion that are closed source is rather small.
How similar is MacRuby?
def functions(with, this: syntax="default value") end
but over all, I think rubmyotion rocks and I hope and brings some great Objective-c/Cocoa world into ruby-world and vice-versa.
syntax = options[:syntax] || "default value"
...in the method body. Still, it would be nice to have it built in.
http://rosettacode.org/wiki/Named_parameters#Ruby.27s_future
I would expect MacRuby and RubyMotion to follow.
He actually left Apple to launch RubyMotion -- a commercial product, by the way -- after creating MacRuby and developing/maintaining it for several years.
Check the tutorial for an explanation of how to use it. Disclaimer: I'm the author. :)
It's supposed to help readability while maximizing screen use in those cases (instead of either stretching out paragraphs to two lines or centering the body as to take up only a small percentage of the window). I'll change it to trigger on a wider dimension, sorry!
Lots of low-level stuff there, which is very very impressive.
Yes, very nice. And also very annoying.
Using these little shortcuts everywhere is confusing. There is no order in things.
ObjC is beautiful. There are classes, instances, methods, blocks. And everything has its place.
This is a mess, Rails is a mess, most of Ruby code is a mess.
Proceed with the downvotes.