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

RubyMotion Gets A Cool New Friend: mruby on iOS

RubyMotion Gets A Cool New Friend: mruby on iOS

7f403c925a51bf816b8c31c77c6f678b?s=128

Joseph Ku

April 25, 2014
Tweet

Transcript

  1. RubyConf Taiw an RubyMotion Gets A Cool New Friend mruby

    on iOS
  2. Who Am I?

  3. 古傑芳

  4. @josephku

  5. None
  6. ! WHAT’S RUBYMOTION? A Ruby toolchain for iOS Develop and

    test native iOS app in Ruby Based on MacRuby
  7. Objective-C Objective-C Runtime iOS SDK Foundation Framework

  8. Objective-C Objective-C Runtime iOS SDK Foundation Framework RubyMotion

  9. ! WHY RUBYMOTION? 100% native code Keep your editor App

    Store compliant
  10. None
  11. None
  12. None
  13. None
  14. ! DEPLOYMENT Deploy your app to beta testers by TestFlight

    ! ! Deploy to App Store $ rake archive:distribution $ gem install motion-testflight $ rake testflight notes='Orz'
  15. ! UPDATES FOR RUBYMOTION Xcode 5.1 & iOS 7.1 support

    OS X support Templates Fix tons of memory management issues Background fetching Performance improvements
  16. WWDC 2013 June 10-14

  17. Super aggressive team!

  18. Babe, Let’s Rock!!

  19. class Test def test foo = 42 Proc.new { foo

    + 123 } end end ! Test.new.test.call # Crashes sometimes
  20. mruby 1.0.0

  21. None
  22. How about mruby on Apple’s 64-bit A7 SoC?

  23. app.archs['iPhoneOS'] << 'arm64' RubyMotion - Rakefile

  24. MRuby::CrossBuild.new('ios-arm64') do |conf| toolchain :gcc ! conf.cc.flags << "-arch arm64"

    conf.linker.flags << "-arch arm64” # ... ! end mruby - build_config.rb
  25. #define MRB_INT64

  26. #define MRB_USE_FLOAT

  27. #define MRB_USE_FLOAT; #define MRB_INT64 0% 1% 2% 3% 4% 5%

    6% bm_so_lists.rb fib39.rb Benchmark on A7
  28. None
  29. None
  30. 64-bit RiteVM

  31. ! WHY MRUBY & RUBYMOTION? Focusing Avoiding limitations

  32. DSL

  33. mruby + RubyMotion = ?

  34. Where to use?

  35. Explain things better

  36. None
  37. { "uuid": "B9407F30-F5F8-466E-AFF9-25556B57FE6D", "events": [ { "proximity": "immediate", "url": "http://host.com/event/1"

    }, { "proximity": "near", "url": "http://host.com/event/2" }, { "proximity": "far", "url": "http://host.com/event/3" } ] }
  38. None
  39. beacon b1 do uuid "B9407F30-F5F8-466E-AFF9-25556B57FE6D" major 75682 minor 1 end

    ! beacon b2 do uuid "B9407F30-F5F8-466E-AFF9-25556B57FE6D" major 75682 minor 2 end ! beacon b3 do uuid "B9407F30-F5F8-466E-AFF9-25556B57FE6D" major 75682 minor 3 end ! event b1.far, b2.near do url “https://host.com/event/1" end ! event b2.immediate, !b3.far do url “https://host.com/event/2" end
  40. Game scripting in mruby

  41. Lua! Ruby!

  42. Babe, Let’s Rock!!

  43. Hide your code

  44. #include <stdint.h> const uint8_t nothing_here[] = { 0x52,0x49,0x54,0x45,0x30,0x30,0x30,0x32,0x1f,0xef,0x00,0x00,0x00,0x62,0x4d,0x41, 0x54,0x5a,0x30,0x30,0x30,0x30,0x49,0x52,0x45,0x50,0x00,0x00,0x00,0x44,0x30,0x30, 0x30,0x30,0x00,0x00,0x00,0x38,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x04,

    0x00,0x80,0x00,0x06,0x01,0x00,0x00,0x3d,0x00,0x80,0x00,0xa0,0x00,0x00,0x00,0x4a, 0x00,0x00,0x00,0x01,0x00,0x00,0x08,0x74,0x6f,0x6c,0x64,0x20,0x79,0x6f,0x75,0x00, 0x00,0x00,0x01,0x00,0x04,0x70,0x75,0x74,0x73,0x00,0x45,0x4e,0x44,0x00,0x00,0x00, 0x00,0x08, }; secret.c $ mrbc -Bnothing_here secret.rb mrb.read_irep nothing_here mrb.run
  45. Ruby Everywhere!!

  46. Any questions?

  47. Thank you!