Are you fed up with Objective-C? Now, you can build iOS apps with Ruby (mruby)!.
MobiRuby takes advantage of mruby, which is a minimalistic implementation of Ruby. It is a relatively new endeavour by the Ruby founder, matz. Watch the keynote. mruby was released on April, 20th, 2012.
MobiRuby aims to replace Objective-C/C/Java on mobile platforms with Ruby, just like you can use Lua or Mono to build apps on those platforms. Now, we have mruby thanks to Matz!
Now, we are working on iOS and Objective-C. We will port MobiRuby to Android at next step.
Currently, It's released alpha version on https://github.com/mobiruby/mobiruby-ios.
MobiRuby is available under the MIT License.
Currently, You need call Cocoa functions throught Ruby code for making MobiRuby app. We're focusing to build Cocoa bridge now.
In next step, We'll create natual Ruby library for making iOS application.
# UIAlertView demo
class Cocoa::MyAlertView < Cocoa::UIAlertView
define C::Void, :didPresentAlertView, Cocoa::Object do
p "MyAlertView::didPresentAlertView"
end
define C::Void, :alertView, Cocoa::Object, :clickedButtonAtIndex, C::Int do |me, index|
if index.to_i == 1
app = Cocoa::UIApplication._sharedApplication
url = Cocoa::NSURL._URLWithString("http://mobiruby.org")
app._openURL url
end
end
end
alert = Cocoa::MyAlertView._alloc._initWithTitle "Hello",
:message, "I am MobiRuby",
:delegate, nil,
:cancelButtonTitle, "I know!",
:otherButtonTitles, "What's?", nil
alert._setDelegate alert
alert._show
AppStore already accepted MobiRuby based apps.
RubyConf 2012
Slides and scriptmruby & MobiRuby intro