27
RubyMotion and ProMotion Wouter de Vos @wrdevos | Springest Jan 21, 2014

RubyMotion and ProMotion - Ams.rb Talk

Embed Size (px)

DESCRIPTION

My talk about RubyMotion and ProMotion on the Ams.rb meetup of January 2014. Fonts: PT Serif and Meslo. All vector images by me, ping me @wrdevos if you want them. Apple Says No Demo App is here: https://github.com/foxycoder/apple_says_no

Citation preview

Page 1: RubyMotion and ProMotion - Ams.rb Talk

RubyMotion and ProMotion

Wouter de Vos @wrdevos | Springest

Jan 21, 2014

Page 2: RubyMotion and ProMotion - Ams.rb Talk

Springest is a

Website where you can

find and compare courses.

Page 3: RubyMotion and ProMotion - Ams.rb Talk

My Springest Track found

courses, enrolments finished courses

Page 4: RubyMotion and ProMotion - Ams.rb Talk

Discovery automated

suggestions based on e.g. your

search history

and LinkedIn profile.

Page 5: RubyMotion and ProMotion - Ams.rb Talk

Why an iOS App?More personalised feel

!

Once installed, you carry it everywhere

!

Push notifications

Page 6: RubyMotion and ProMotion - Ams.rb Talk

My First

App (Being A Web Developer And All..)

Page 7: RubyMotion and ProMotion - Ams.rb Talk

Location Services

to select the right localised

site for you.

Page 8: RubyMotion and ProMotion - Ams.rb Talk

AND even persistent cookies,

LinkedIn integration...

Page 9: RubyMotion and ProMotion - Ams.rb Talk

Big Apple says no.

Page 10: RubyMotion and ProMotion - Ams.rb Talk

WebView? REJECTED. Period.

Page 11: RubyMotion and ProMotion - Ams.rb Talk

Dammit.

Page 12: RubyMotion and ProMotion - Ams.rb Talk
Page 13: RubyMotion and ProMotion - Ams.rb Talk

// Password field _passwordField = [[UITextField alloc] initWithFrame: CGRectMake(72, 394, 180, 30)]; [_passwordField setBorderStyle:UITextBorderStyleRoundedRect]; _passwordField.placeholder = @"Password"; _passwordField.secureTextEntry = YES; _passwordField.delegate = self; [_passwordField setReturnKeyType:UIReturnKeyDone]; [_passwordField addTarget:self action:@selector(textFieldFinished:) forControlEvents: UIControlEventEditingDidEndOnExit]; _passwordField.tag = kPasswordField; [_scrollView addSubview:_passwordField];

Page 14: RubyMotion and ProMotion - Ams.rb Talk

RubyMotionwhoah, ruby?

Page 15: RubyMotion and ProMotion - Ams.rb Talk

def application( didFinishLaunchingWithOptions: launch_options )

Ruby? rly?

Page 16: RubyMotion and ProMotion - Ams.rb Talk

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions !

def application( application, didFinishLaunchingWithOptions: launch_options ) !

- (BOOL)application:(UIApplication *)application !

def application( application )

Compare these..

Page 17: RubyMotion and ProMotion - Ams.rb Talk

!

def application( application, didFinishLaunchingWithOptions: launch_options ) !

!

!

def application( application )

That defines the same method twice!

Page 18: RubyMotion and ProMotion - Ams.rb Talk

// Sign in button _signInButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; _signInButton.frame = CGRectMake(73, 432, 178, 30); [_signInButton setTitle:@"Sign in" forState:UIControlStateNormal]; [_scrollView addSubview:_signInButton]; !

# Sign in button @sign_in_button = UIButton.buttonWithType UIButtonTypeRoundedRect @sign_in_button.frame = CGRectMake(73, 432, 178, 30) @sign_in_button.setTitle: "Sign in", forState: UIControlStateNormal @scrollView.addSubview: @sign_in_button !

Much difference?

Page 19: RubyMotion and ProMotion - Ams.rb Talk

BubbleWrapadds some ruby love

Page 20: RubyMotion and ProMotion - Ams.rb Talk
Page 21: RubyMotion and ProMotion - Ams.rb Talk

BubbleWrapadds some ruby love

HTTP

Camera

media

events location

RSS

Check it out!

UI

Page 22: RubyMotion and ProMotion - Ams.rb Talk

ProMotionmore ruby love

Page 23: RubyMotion and ProMotion - Ams.rb Talk
Page 24: RubyMotion and ProMotion - Ams.rb Talk

class  AppDelegate  <  PM::Delegate  !

   def  on_load(app,  options)          open  RootScreen.new(nav_bar:  true)      end  !

end

Now we’re talking Ruby

Page 25: RubyMotion and ProMotion - Ams.rb Talk

#  app/screens/root_screen.rb  !

class  RootScreen  <  PM::Screen      title  "Root  Screen"  !

   def  on_load          set_nav_bar_button  :right,  title:  "Help",  action:  :help      end  !

   def  help          open  HelpScreen      end  end  

PM::Screen

Page 26: RubyMotion and ProMotion - Ams.rb Talk

def  on_load      set_attributes  self.view,  {          background_color:  hex_color("DBDBDB")      }            add  UILabel.new,  {          text:  "August",          text_color:  hex_color("8F8F8D"),          background_color:  UIColor.clearColor,          shadow_color:  UIColor.blackColor,          text_alignment:  UITextAlignmentCenter,          font:  UIFont.systemFontOfSize(15.0),          resize:  [  :left,  :right,  :bottom  ],          frame:  CGRectMake(10,  0,  300,  35)      }  end

PM::Styling

Page 27: RubyMotion and ProMotion - Ams.rb Talk

Thanks!spread the ruby love

Wouter de Vos @wrdevos