View
611
Download
3
Category
Tags:
Preview:
DESCRIPTION
RubyMotion talk by Marc Rendl Ignacio during the October 2012 PHRUG (Philippine Ruby User Group) meetup held at the AELOGICA office.
Citation preview
RubyMotionMaking iOS apps in Ruby
@pd_i
Prerequisites
Prerequisites
Ruby MVCObjective-C*
*optional
What isRubyMotion?
Ruby toolchain for iOS
Author:Laurent Sansonetti
(MacRuby)
1.9compliant
Objective-C RuntimeFoundation Framework
iOS SDK
Objective-C
Something
Objective-C RuntimeFoundation Framework
Objective-C
iOS SDK
RubyMotion
Different...
...but the same
GaryOldman
Observations
RubyMotionObjective-C Objects
RubyMotion Objects# Ruby"PHRUG".class.ancestors=> [String, Comparable, Object, Kernel, BasicObject]
# RubyMotion"PHRUG".class.ancestors=> [String, NSMutableString, NSString, Comparable, NSObject, Kernel]
RubyMotion Objects# RubyMotionObject == NSObject=> true
Objective-CRubyMotion Methods
RubyMotion Methods# Objective-C / CocoaNSString *string = [[NSString alloc] initWithString:@"PhRuG"];
# RubyMotionstring = NSString.alloc.initWithString "PhRuG"
RubyMotion Methods# Objective-C / CocoaNSString *string = [[NSString alloc] initWithString:@"PhRuG"];[string uppercaseString] => "PHRUG";# RubyMotionstring = NSString.alloc.initWithString "PhRuG"string.uppercaseString => "PHRUG"
RubyMotion Methods# Objective-C / CocoaNSString *string = [[NSString alloc] initWithString:@"PhRuG"];[string uppercaseString] => "PHRUG";# RubyMotionstring = NSString.alloc.initWithString "PhRuG"string.uppercaseString => "PHRUG"# we can still use ruby methods!string.upcase => "PHRUG"
Named Parameters
Named Parameters# Objective-C, named parameters[string drawAtPoint: point withFont:font]# RubyMotionstring.drawAtPoint(point, withFont:font)# using sendstring
.send(:"drawAtPoint:withFont:", point, font)
Named Parameters# Objective-C, named parameters[string drawAtPoint: point withFont:font]# RubyMotionstring.drawAtPoint(point, withFont:font)# using sendstring
.send(:"drawAtPoint:withFont:", point, font)
If they're the
same...
... why use it?
Good
Stuff
Power
Editor+
Terminal
Rake
rake simulator
rake device
rake spec
Testing(MacBacon)
Garbage Collection
REPL(read-eval-print loop)
DSLs(domain specific languages)
Cocoapods
Disadvantages
Disadvantages● Cost
○ $199.99 with 1 year updates○ $99 per year to continue updates
● Most resources are in Objective-C● Not an excuse to not learn Objective-C● No RubyMotion Book (yet)
Demo Time!
Questions?
● rubymotion.com● rubymotion.com/developer-center● slideshare.net/markvilla/macruby-rubymotion-
madridrb-may-2012-13154591● http://www.slideshare.net/clayallsopp/preview-
unicorns-magic-and-better-apps-with-rubymotion [for the Gary Oldman metaphor :) ]
Resources
Images● http://rubyidentity.org/● http://www.rubymotion.com/press/ ● developer.apple.
com/technologies/mac/cocoa.html● cocoapods.org
Thanks!
Marc Ignaciotwitter: @pd_i github: @padi
Recommended