rubymotion introduction

49
RubyMotion Making iOS apps in Ruby

Upload: marc-rendl-ignacio

Post on 12-May-2015

609 views

Category:

Technology


3 download

DESCRIPTION

RubyMotion talk by Marc Rendl Ignacio during the October 2012 PHRUG (Philippine Ruby User Group) meetup held at the AELOGICA office.

TRANSCRIPT

Page 1: RubyMotion Introduction

RubyMotionMaking iOS apps in Ruby

Page 2: RubyMotion Introduction

@pd_i

Page 3: RubyMotion Introduction
Page 4: RubyMotion Introduction

Prerequisites

Page 5: RubyMotion Introduction

Prerequisites

Ruby MVCObjective-C*

*optional

Page 6: RubyMotion Introduction

What isRubyMotion?

Page 7: RubyMotion Introduction
Page 8: RubyMotion Introduction
Page 9: RubyMotion Introduction

Ruby toolchain for iOS

Page 10: RubyMotion Introduction

Author:Laurent Sansonetti

(MacRuby)

Page 11: RubyMotion Introduction

1.9compliant

Page 12: RubyMotion Introduction

Objective-C RuntimeFoundation Framework

iOS SDK

Objective-C

Something

Page 13: RubyMotion Introduction

Objective-C RuntimeFoundation Framework

Objective-C

iOS SDK

RubyMotion

Page 14: RubyMotion Introduction

Different...

Page 15: RubyMotion Introduction

...but the same

GaryOldman

Page 16: RubyMotion Introduction

Observations

Page 17: RubyMotion Introduction

RubyMotionObjective-C Objects

Page 18: RubyMotion Introduction

RubyMotion Objects# Ruby"PHRUG".class.ancestors=> [String, Comparable, Object, Kernel, BasicObject]

# RubyMotion"PHRUG".class.ancestors=> [String, NSMutableString, NSString, Comparable, NSObject, Kernel]

Page 19: RubyMotion Introduction

RubyMotion Objects# RubyMotionObject == NSObject=> true

Page 20: RubyMotion Introduction

Objective-CRubyMotion Methods

Page 21: RubyMotion Introduction

RubyMotion Methods# Objective-C / CocoaNSString *string = [[NSString alloc] initWithString:@"PhRuG"];

# RubyMotionstring = NSString.alloc.initWithString "PhRuG"

Page 22: RubyMotion Introduction

RubyMotion Methods# Objective-C / CocoaNSString *string = [[NSString alloc] initWithString:@"PhRuG"];[string uppercaseString] => "PHRUG";# RubyMotionstring = NSString.alloc.initWithString "PhRuG"string.uppercaseString => "PHRUG"

Page 23: RubyMotion Introduction

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"

Page 24: RubyMotion Introduction

Named Parameters

Page 25: RubyMotion Introduction

Named Parameters# Objective-C, named parameters[string drawAtPoint: point withFont:font]# RubyMotionstring.drawAtPoint(point, withFont:font)# using sendstring

.send(:"drawAtPoint:withFont:", point, font)

Page 26: RubyMotion Introduction

Named Parameters# Objective-C, named parameters[string drawAtPoint: point withFont:font]# RubyMotionstring.drawAtPoint(point, withFont:font)# using sendstring

.send(:"drawAtPoint:withFont:", point, font)

Page 27: RubyMotion Introduction

If they're the

same...

Page 28: RubyMotion Introduction

... why use it?

Page 29: RubyMotion Introduction

Good

Stuff

Page 30: RubyMotion Introduction

Power

Page 31: RubyMotion Introduction

Editor+

Terminal

Page 32: RubyMotion Introduction

Rake

Page 33: RubyMotion Introduction

rake simulator

Page 34: RubyMotion Introduction

rake device

Page 35: RubyMotion Introduction

rake spec

Page 36: RubyMotion Introduction

Testing(MacBacon)

Page 37: RubyMotion Introduction

Garbage Collection

Page 38: RubyMotion Introduction

REPL(read-eval-print loop)

Page 39: RubyMotion Introduction

DSLs(domain specific languages)

Page 40: RubyMotion Introduction

Cocoapods

Page 41: RubyMotion Introduction

Disadvantages

Page 42: RubyMotion Introduction

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)

Page 43: RubyMotion Introduction

Demo Time!

Page 44: RubyMotion Introduction

Questions?

Page 45: RubyMotion Introduction

● 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

Page 46: RubyMotion Introduction

Images● http://rubyidentity.org/● http://www.rubymotion.com/press/ ● developer.apple.

com/technologies/mac/cocoa.html● cocoapods.org

Page 47: RubyMotion Introduction

Thanks!

Page 48: RubyMotion Introduction

Marc Ignaciotwitter: @pd_i github: @padi

Page 49: RubyMotion Introduction