Javaseruby: Lightweight Framework for iOS application development using Ruby

Source: Internet
Author: User

This project was initiated by Yuichiro MASUI, which is used by Appcelerator. Appcelerator is a company that provides a mobile platform development framework. Its Titanium development framework allows developers to develop mobile applications in familiar languages.

MobiRuby is built based on mruby (a lightweight Ruby language implementation that can run Ruby code in interpreted mode and run it in a virtual machine. Yuichiro MASUI hopes to use this framework to enable Ruby to develop mobile applications instead of the Objective-C/Java language, just like Lua or Mono.

Currently, this project has only one sample code and Yuichiro said that the first version will be released in the next few months and will be based on the Apache 2.0 license agreement.

MobiRuby example:

Ruby code:

 
 
  1. # UIAlertView demo  
  2. def _S(str)  
  3.     NSString._stringWithUTF8String(str)  
  4. end 
  5. class MyAlertView < Mobi::Cocoa::UIAlertView  
  6.     define :void, :didPresentAlertView, :id do 
  7.         p "MyAlertView::didPresentAlertView" 
  8.     end 
  9.     define :void, :alertView, :id, :clickedButtonAtIndex, :int do |me, index|  
  10.         if index == 1  
  11.             app = UIApplication._sharedApplication  
  12.             url = NSURL._URLWithString(_S("http://mobiruby.org"))  
  13.             app._openURL url  
  14.         end 
  15.     end 
  16. end 
  17. alert = MyAlertView._alloc.  
  18.     _initWithTitle _S("Hello"),  
  19.     :message, _S("I'm MobiRuby"),  
  20.     :delegate, nil,  
  21.     :cancelButtonTitle, _S("I know!"),  
  22.     :otherButtonTitles, _S("What's?"), nil 

Running result:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.