RubyMotion Intro
- static ruby compiler using MacRuby implementation
- build is done using Rake
- standard project directory structure
- plist settings are done via settings inside of the Rakefile
Objective-C --> Ruby
UIView *view = [[UIView alloc] init]
becomes
view = UIView.alloc.init
In RubyMotion/MacRuby, allocating objects that are Objective-C objects use .alloc.init instead of .new
OBJECTiVE-C --> Ruby #2
UIViewController *viewController = [[UIViewController alloc] initWithNibName: @"my-nib" bundle: nil]
becomes
viewController = UIViewController.alloc.initWithNibName("my-nib", bundle: nil)
OBJECTIVe-C to Ruby
MacRuby/RubyMotion unify primitives and objects so that you don't have to think about which is which unless you are passing pointers to framework classes.
NSString becomes String
CGRectMake becomes CGRect.new
NSInteger becomes Integer
CGFloat becomes Float
(^block) becomes Lambda