5 ms·
The RubyMotion Way
- DarwinOS 14y agoI sometimes wish rubymotion and macruby had named parameter with default value, something like 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.
- learc83 14y agoYou can setup your method to accept a hash, and then do something like this... syntax = options[:syntax] || "default value" ...in the method body. Still, it would be nice to have it built in.
- Argorak 14y agoRuby 2.0 will introduce this: http://rosettacode.org/wiki/Named_parameters#Ruby.27s_future http://rosettacode.org/wiki/Named_parameters#Ruby.27s_future I would expect MacRuby and RubyMotion to follow.
- smoody 14y ago" If you've tried projects in Ruby and just didn't like it, RubyMotion probably won't change your mind. But if you've ever wanted to make iOS or Mac apps but didn't want to get over the hump that is Objective-C, maybe this will get you going." Can RubyMotion itself be used to create Mac apps in addition to iOS apps?
- jballanc 14y agoRubyMotion is descended from MacRuby, which can most definitely be used to create Mac apps (a number are already available in the Mac App store).
- 10char 14y agoSorry, should have specified! As jballanc said, I was referring to MacRuby (http://macruby.org/ http://macruby.org/). I'll add a link there for clarification. 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.
- objclxt 14y agoThere is, of course, one important different between MacRuby and Ruby Motion: the former is GPL compliant, and the latter is commercially licensed. 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.
- hlidotbe 14y agoOf course it's a shame that Laurent needs to eat and of course this has everything to do about RM being able to build for Mac or not. Knowing him, I know he would prefer RM to be open source but it would be much harder for him to monetize his efforts. 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.
- veyron 14y agoHe would make more money charging for support or for the tail end (e.g. codesigning).
- jballanc 14y agoThere is still a lot that you can do to contribute back to the project. Much of the build system and various supporting libraries have been open-sourced. Furthermore, it is the stated goal of RubyMotion that development of higher-level abstraction libraries should be driven by the community. 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.
- mapgrep 14y agoIf you want a deeper dive into RubyMotion, the creator was just on The Changelog podcast - http://thechangelog.com/post/25928209107/episode-0-8-2-ruby-motion-macruby-and-more-with-laurent http://thechangelog.com/post/25928209107/episode-0-8-2-ruby-... He actually left Apple to launch RubyMotion -- a commercial product, by the way -- after creating MacRuby and developing/maintaining it for several years.
- petercooper 14y agoWhy the tricky horizontal scrolling on this page? (In Chrome and Firefox, at least. Oddly, Safari presents it as a regular vertical page..)
- 10char 14y agoIt's because of a media query that responds to wider window sizes, strange that it didn't register in all your browsers (it does on my Safari when I fullscreen) 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!
- petercooper 14y agoAha, that would explain it. I almost never use Safari so its natural size is likely somewhat thinner than my day to day browser :-) I was just over your ~1300ish pixel width.
- Void_ 14y ago> (after the code preview) Pretty nice right? 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.
- thmzlt 14y agoProceed with the semicolons.
- flatline3 14y ago> Rubyists get a lot of flak for the kind of DSLs and black magic method_missing tricks the above libraries use; but you know what, maybe that attitude is just what Objective-C has been missing. 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.
- 10char 14y agoI think the value add of a `when` style isn't saving keystrokes but improving readability. What happens when the event fires is right there in-line with the button, not somewhere else on the page. Yeah there are editor tricks to command+click to it and such, but that's still some overhead. 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.
- flatline3 14y ago> I think the value add of a `when` style isn't saving keystrokes but improving readability. What happens when the event fires is right there in-line with the button, not somewhere else on the page. Yeah there are editor tricks to command+click to it and such, but that's still some overhead. 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.
- dogan 14y agoiOS development is not only objective-c and Cocoa Touch. XCode, interface builder, instruments are also big helpers and sometimes there can be memory problems that you can only trace with instrument.
- 10char 14y agoDefinitely. I know RubyMotion currently supports XIBs and Storyboards, but yeah there's no integrated solution with Xcode or Instruments right now. I personally like the Rake-based approach, its more lightweight than booting up an IDE, but I would bet that better Xcode support is possible since MacRuby already does it pretty well.
- marknutter 14y agoThat's if you like using interface builder. I personally dislike it and prefer to lay things out programmatically, but this probably has to do with the fact that I came to iOS development from the web development world.
- dogan 14y agoI also try to not use IB most of the time, but especially if you are building not so custom designs, IB really increase the productivity and keep the code clean.
- mattgreenrocks 14y agoNitron has [slightly hacky] support for IB: https://github.com/mattgreen/nitron https://github.com/mattgreen/nitron Check the tutorial for an explanation of how to use it. Disclaimer: I'm the author. :)
- danso 14y agoAre there examples of products that were developed with RubyMotion?
- taybenlor 14y agoI don't know if theres a big list, but this blog post mentions some http://blog.rubymotion.com/post/24197887535/community-open-source-updates http://blog.rubymotion.com/post/24197887535/community-open-s...
- cnp 14y agoThis is a pretty mindblowing app example which is on it's way to the app store: http://clip.ignition.hk/ http://clip.ignition.hk/ Lots of low-level stuff there, which is very very impressive.
- 21sappers 14y agoThat is a very cool app. Thanks for sharing the link!