rubymotion: hack your ios app like never before

37
RubyConf Taiwan RubyMotion HACK YOUR IOS APP LIKE NEVER BEFORE

Upload: joseph-ku

Post on 15-May-2015

891 views

Category:

Technology


0 download

DESCRIPTION

* Talk @ RubyConf Taiwan 2012 (2012.12.08)

TRANSCRIPT

Page 1: RubyMotion: Hack Your iOS App Like Never Before

RubyCo

nf Taiw

an

RubyMotionHACK YOUR IOS APP LIKE NEVER BEFORE

Page 2: RubyMotion: Hack Your iOS App Like Never Before

Who Am I?

Page 3: RubyMotion: Hack Your iOS App Like Never Before

古傑芳

Page 4: RubyMotion: Hack Your iOS App Like Never Before

@josephku

Page 5: RubyMotion: Hack Your iOS App Like Never Before
Page 6: RubyMotion: Hack Your iOS App Like Never Before

WHAT’S RUBYMOTION?

A Ruby toolchain for iOS

Develop and test native iOS app in Ruby

Based on MacRuby

Laurent Sansonetti (@lrz)

Page 7: RubyMotion: Hack Your iOS App Like Never Before

Why RubyMotion?

Page 8: RubyMotion: Hack Your iOS App Like Never Before
Page 9: RubyMotion: Hack Your iOS App Like Never Before

Objective-C

Objective-C Runtime

iOS SDK

Foundation Framework

Page 10: RubyMotion: Hack Your iOS App Like Never Before

Objective-C

Objective-C Runtime

iOS SDK

Foundation Framework

RubyMotion

Page 11: RubyMotion: Hack Your iOS App Like Never Before
Page 12: RubyMotion: Hack Your iOS App Like Never Before
Page 13: RubyMotion: Hack Your iOS App Like Never Before
Page 14: RubyMotion: Hack Your iOS App Like Never Before

WHY RUBYMOTION?

100% native code

Keep your editor

App Store compliant

Page 15: RubyMotion: Hack Your iOS App Like Never Before

Babe, Let’s Rock!!

Page 16: RubyMotion: Hack Your iOS App Like Never Before

Dirty

Page 17: RubyMotion: Hack Your iOS App Like Never Before

Dirty

Page 18: RubyMotion: Hack Your iOS App Like Never Before

The Last Mile

Page 19: RubyMotion: Hack Your iOS App Like Never Before

DEPLOYMENT

Deploy your app to beta testers by TestFlight

Deploy to App Store

$ rake archive:distribution

$ gem install motion-testflight

$ rake testflight notes='Orz'

Page 20: RubyMotion: Hack Your iOS App Like Never Before

// Foo.h@interface Foo: NSObject{}@property (nonatomic, strong) NSString *bar;@end

// Foo.m#import “Foo.h”@implementation Foo@synthesize bar = _bar;@end

class Foo attr_accessor :barend

Objective-C

RubyMotion

Page 21: RubyMotion: Hack Your iOS App Like Never Before

outputImageProviderFromBufferWithPixelFormat:pixelsWide:pixelsHigh:baseAddress:bytesPerRow:releaseCallback:releaseContext:colorSpace:shoul

dColorMatch:

WTF!!

Page 22: RubyMotion: Hack Your iOS App Like Never Before

NSDictionary *rules = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber NumberWithBool:TRUE],"RubyIsAwesome",nil];

Objective-C

RubyMotionrules = { RubyIsAwesome: 1 }

What’s the magic??

Page 23: RubyMotion: Hack Your iOS App Like Never Before

Babe, Rock Again!!

Page 24: RubyMotion: Hack Your iOS App Like Never Before

LIMITATIONS

require

eval

define_method

Proc#binding

Regular gems don’t work

Page 25: RubyMotion: Hack Your iOS App Like Never Before

PROS & CONS

One-time fee of $199

Growing faster and faster

Apple’s attitude

Page 26: RubyMotion: Hack Your iOS App Like Never Before

Is RubyMotion the future?

Page 27: RubyMotion: Hack Your iOS App Like Never Before

DSL

Page 28: RubyMotion: Hack Your iOS App Like Never Before

App.alert("BubbleWrap is awesome!")App.run_after(0.5) { p "It's #{Time.now}" }App.open_url("http://rubyconf.tw/2012/")

Device.iphone?Device.ipad?Device.front_camera?

BW::Media.play_modal("http://www.hrupin.com/wp-content/uploads/mp3/testsong_20_sec.mp3")

EM.add_timer 1.0 do puts "Great scott!"end

Page 29: RubyMotion: Hack Your iOS App Like Never Before
Page 30: RubyMotion: Hack Your iOS App Like Never Before
Page 31: RubyMotion: Hack Your iOS App Like Never Before

RubyMine

Page 32: RubyMotion: Hack Your iOS App Like Never Before
Page 33: RubyMotion: Hack Your iOS App Like Never Before
Page 34: RubyMotion: Hack Your iOS App Like Never Before

IS THE RUBYMOTION THE FUTURE?

DSL

Well-known editor and IDE Support

Active community

Page 35: RubyMotion: Hack Your iOS App Like Never Before

C’mon, it’s Ruby!!

Page 36: RubyMotion: Hack Your iOS App Like Never Before

Any questions?

Page 37: RubyMotion: Hack Your iOS App Like Never Before

Thank you!