RubyConf Taiw
an
RubyMotion Gets A
Cool New Friend
mruby on iOS
Who Am I?
古傑芳
@josephku
!WHAT’S
RUBYMOTION?
A Ruby toolchain for iOS
Develop and test native iOS app in Ruby
Based on MacRuby
Objective-C
Objective-C Runtime
iOS SDK
Foundation Framework
Objective-C
Objective-C Runtime
iOS SDK
Foundation Framework
RubyMotion
!
WHY RUBYMOTION?
100% native code
Keep your editor
App Store compliant
!
DEPLOYMENT
Deploy your app to beta testers by TestFlight
!
!
Deploy to App Store
$ rake archive:distribution
$ gem insta...
!UPDATES FOR
RUBYMOTION
Xcode 5.1 & iOS 7.1 support
OS X support
Templates
Fix tons of memory management issues
Background...
WWDC 2013 June 10-14
Super aggressive team!
Babe, Let’s Rock!!
class Test	
def test	
foo = 42	
Proc.new { foo + 123 }	
end	
end	
!
Test.new.test.call # Crashes sometimes
mruby
1.0.0
How about mruby on
Apple’s 64-bit A7 SoC?
app.archs['iPhoneOS'] << 'arm64'
RubyMotion - Rakefile
MRuby::CrossBuild.new('ios-arm64') do |conf|	
toolchain :gcc	
!
conf.cc.flags << "-arch arm64"	
conf.linker.flags << "-arc...
#define MRB_INT64
#define MRB_USE_FLOAT
#define MRB_USE_FLOAT; #define MRB_INT64
0%
1%
2%
3%
4%
5%
6%
bm_so_lists.rb fib39.rb
Benchmark on A7
64-bit RiteVM
!WHY MRUBY &
RUBYMOTION?
Focusing
Avoiding limitations
DSL
mruby + RubyMotion = ?
Where to use?
Explain things better
{	
"uuid": "B9407F30-F5F8-466E-AFF9-25556B57FE6D",	
"events": [	
{	
"proximity": "immediate",	
"url": "http://host.com/eve...
beacon b1 do	
uuid "B9407F30-F5F8-466E-AFF9-25556B57FE6D"	
major 75682	
minor 1	
end	
!
beacon b2 do	
uuid "B9407F30-F5F8-...
Game scripting in mruby
Lua! Ruby!
Babe, Let’s Rock!!
Hide your code
#include <stdint.h>	
const uint8_t nothing_here[] = {	
0x52,0x49,0x54,0x45,0x30,0x30,0x30,0x32,0x1f,0xef,0x00,0x00,0x00,0x...
Ruby Everywhere!!
Any questions?
Thank you!
RubyMotion Gets A Cool New Friend: mruby on iOS
RubyMotion Gets A Cool New Friend: mruby on iOS
RubyMotion Gets A Cool New Friend: mruby on iOS
RubyMotion Gets A Cool New Friend: mruby on iOS
RubyMotion Gets A Cool New Friend: mruby on iOS
RubyMotion Gets A Cool New Friend: mruby on iOS
RubyMotion Gets A Cool New Friend: mruby on iOS
RubyMotion Gets A Cool New Friend: mruby on iOS
RubyMotion Gets A Cool New Friend: mruby on iOS
RubyMotion Gets A Cool New Friend: mruby on iOS
Upcoming SlideShare
Loading in …5
×

RubyMotion Gets A Cool New Friend: mruby on iOS

775 views
526 views

Published on

Published in: Technology, Design
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
775
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

RubyMotion Gets A Cool New Friend: mruby on iOS

  1. 1. RubyConf Taiw an RubyMotion Gets A Cool New Friend mruby on iOS
  2. 2. Who Am I?
  3. 3. 古傑芳
  4. 4. @josephku
  5. 5. !WHAT’S RUBYMOTION? A Ruby toolchain for iOS Develop and test native iOS app in Ruby Based on MacRuby
  6. 6. Objective-C Objective-C Runtime iOS SDK Foundation Framework
  7. 7. Objective-C Objective-C Runtime iOS SDK Foundation Framework RubyMotion
  8. 8. ! WHY RUBYMOTION? 100% native code Keep your editor App Store compliant
  9. 9. ! DEPLOYMENT Deploy your app to beta testers by TestFlight ! ! Deploy to App Store $ rake archive:distribution $ gem install motion-testflight $ rake testflight notes='Orz'
  10. 10. !UPDATES FOR RUBYMOTION Xcode 5.1 & iOS 7.1 support OS X support Templates Fix tons of memory management issues Background fetching Performance improvements
  11. 11. WWDC 2013 June 10-14
  12. 12. Super aggressive team!
  13. 13. Babe, Let’s Rock!!
  14. 14. class Test def test foo = 42 Proc.new { foo + 123 } end end ! Test.new.test.call # Crashes sometimes
  15. 15. mruby 1.0.0
  16. 16. How about mruby on Apple’s 64-bit A7 SoC?
  17. 17. app.archs['iPhoneOS'] << 'arm64' RubyMotion - Rakefile
  18. 18. MRuby::CrossBuild.new('ios-arm64') do |conf| toolchain :gcc ! conf.cc.flags << "-arch arm64" conf.linker.flags << "-arch arm64” # ... ! end mruby - build_config.rb
  19. 19. #define MRB_INT64
  20. 20. #define MRB_USE_FLOAT
  21. 21. #define MRB_USE_FLOAT; #define MRB_INT64 0% 1% 2% 3% 4% 5% 6% bm_so_lists.rb fib39.rb Benchmark on A7
  22. 22. 64-bit RiteVM
  23. 23. !WHY MRUBY & RUBYMOTION? Focusing Avoiding limitations
  24. 24. DSL
  25. 25. mruby + RubyMotion = ?
  26. 26. Where to use?
  27. 27. Explain things better
  28. 28. { "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" } ] }
  29. 29. 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
  30. 30. Game scripting in mruby
  31. 31. Lua! Ruby!
  32. 32. Babe, Let’s Rock!!
  33. 33. Hide your code
  34. 34. #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
  35. 35. Ruby Everywhere!!
  36. 36. Any questions?
  37. 37. Thank you!

×