Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rubymotion - Ruby <3 iOS

Rubymotion - Ruby <3 iOS

Tiago Bastos

April 08, 2013
Tweet

More Decks by Tiago Bastos

Other Decks in Programming

Transcript

  1. Rubymotion
    Ruby <3 iOS
    Monday, 8 April 13

    View full-size slide

  2. Tiago Bastos
    • @bastos
    • github/bastos
    [email protected]
    Monday, 8 April 13

    View full-size slide

  3. Monday, 8 April 13

    View full-size slide

  4. Why?
    • Ruby
    • Ruby
    • Ruby
    • Nativo
    • Ferramentas
    Monday, 8 April 13

    View full-size slide

  5. Why?
    • Ruby
    • Ruby
    • Ruby
    • Nativo
    • Ferramentas (VIM)
    Monday, 8 April 13

    View full-size slide

  6. Nativo?
    Monday, 8 April 13

    View full-size slide

  7. NATIVO
    Monday, 8 April 13

    View full-size slide

  8. LLVM
    Monday, 8 April 13

    View full-size slide

  9. Monday, 8 April 13

    View full-size slide

  10. Runtime Unificada
    Monday, 8 April 13

    View full-size slide

  11. Mais
    • Gerenciamento de memória ARC Like
    • Concorrência (GCD)
    • Rápido (já falei, nativo!)
    • App Store (TM) Safe
    Monday, 8 April 13

    View full-size slide

  12. Ruby
    Monday, 8 April 13

    View full-size slide

  13. Ruby
    • Módulos (Namespace)
    • Re exão e meta programação
    • O Ruby que você conhece, Menos Eval
    • DSLs
    Monday, 8 April 13

    View full-size slide

  14. DSLs e Wrappers
    • Teacup
    • SugarCube
    • Bubblewrap
    Monday, 8 April 13

    View full-size slide

  15. Monday, 8 April 13

    View full-size slide

  16. class  MyController  <  UIViewController
       stylesheet  :main_screen
       layout  do
           subview(UIButton,  :finished_button)
       end
    end
    Monday, 8 April 13

    View full-size slide

  17. Teacup::Stylesheet.new  :main_screen  do
       style  :finished_button,
           origin:  [10,  10],
           title:  'Hi!'
    end
    Monday, 8 April 13

    View full-size slide

  18.  [[UIApplication  sharedApplication]  openURL:[NSURL  
    URLWithString:  @"https://github.com"]];
    Monday, 8 April 13

    View full-size slide

  19. "https://github.com".nsurl.open
    Monday, 8 April 13

    View full-size slide

  20. UIAlertView  *alert  =  [[UIAlertView  alloc]  
    initWithTitle:@"Do  you  want  to  say  hello?"  
    message:@"More  info..."  delegate:self  
    cancelButtonTitle:@"Cancel"  
    otherButtonTitles:@"Say  Hello",nil];
    [alert  show];
     
    -­‐  (void)alertView:(UIAlertView  *)alertView  
    didDismissWithButtonIndex:(NSInteger)buttonIndex  {
           if  (buttonIndex  ==  0)  {
                   NSLog(@"Cancel  Tapped.");
           }
           else  if  (buttonIndex  ==  1)  {
                   NSLog(@"OK  Tapped.  Hello  World!");
           }
    }
    Monday, 8 April 13

    View full-size slide

  21. UIAlertView.alert  "Is  this  cool?",  
    buttons:  %w[No!  Sure!  Hmmmm],
       message:  "No  going  back  now",
       cancel:  proc  {  self.cancel  },
       success:  proc  {  |pressed|  self.proceed  if  pressed  ==  
    "Sure!"  }
    Monday, 8 April 13

    View full-size slide

  22. UIView.animation_chain  {
       view.slide(:left,  20)
    }.and_then  {
       view.slide(:up,  20)
    }.and_then  {
       view.slide(:right,  20)
    }.and_then  {
       view.slide(:down,  20)
    }.and_then  {
       view.fade_out
    }.start
    Monday, 8 April 13

    View full-size slide

  23. BW::Location.get  do  |result|
       p  "From  Lat  #{result[:from].latitude},  Lng  
    #{result[:from].longitude}"
       p  "To  Lat  #{result[:to].latitude},  Lng  
    #{result[:to].longitude}"
    end
    Monday, 8 April 13

    View full-size slide

  24. Testes
    Monday, 8 April 13

    View full-size slide

  25. button  =  UIButton.buttonWithType(UIButtonTypeRoundedRect)
    button.setTitle('Take  over  the  world',  
    forState:UIControlStateNormal)
    window.addSubview(button)
     
    tap  'Take  over  the  world'
    Monday, 8 April 13

    View full-size slide

  26. Mais!
    • Bootstrap Simples
    • Rubygems
    • Testes
    • Usar bibliotecas em Objective-C (não é
    bridge!)
    Monday, 8 April 13

    View full-size slide

  27. Ferramentas
    • Terminal based
    • Rake
    • Debugging (GDB based)
    • Use seu Editor
    • CocoaPods
    Monday, 8 April 13

    View full-size slide

  28. Monday, 8 April 13

    View full-size slide

  29. Monday, 8 April 13

    View full-size slide

  30. Monday, 8 April 13

    View full-size slide

  31.    app.version  =  '1.0.0'
       app.device_family  =  [:iphone]
       app.interface_orientations  =  [:portrait]
     
       app.files  +=  Dir.glob(File.join(app.project_dir,  'styles/**/*.rb'))
     
       app.development  do
           app.codesign_certificate  =  "iPhone  Developer:  Tiago  Bastos  da  Silva  (HL4267W8QH)"
           app.provisioning_profile  =  File.expand_path("~/Library/MobileDevice/Provisioning  Profiles/CE5529C9-­‐0F02-­‐40BA-­‐
    B2D9-­‐8A342757DBB9.mobileprovision")
       end
     
       app.libs  +=  %w(/usr/lib/libz.dylib  /usr/lib/libsqlite3.dylib)
     
       app.pods  do
           pod  'Facebook-­‐iOS-­‐SDK',  '~>  3.2.1'
           pod  'MBProgressHUD'
       end
     
       app.frameworks  +=  [
           'AudioToolbox',
           'CFNetwork',
           'CoreGraphics',
           'CoreLocation',
           'MobileCoreServices',
           'QuartzCore',
           'Security',
           'StoreKit',
           'SystemConfiguration',
           'Accounts',
           'AdSupport',
           'Social'
    Monday, 8 April 13

    View full-size slide

  32. Perguntas?
    Monday, 8 April 13

    View full-size slide

  33. Perguntas?
    Não?
    Monday, 8 April 13

    View full-size slide

  34. Perguntas?
    Não?
    Ok
    Monday, 8 April 13

    View full-size slide