GUI Programming with MacRuby

3,782 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,782
On SlideShare
0
From Embeds
0
Number of Embeds
92
Actions
Shares
0
Downloads
16
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

GUI Programming with MacRuby

  1. 1. GUI Programming withMacRuby
  2. 2. GUI Programming with MacRubyWho?What?When?Where?Why?How?
  3. 3. Who?
  4. 4. Erik Michaels-Ober?
  5. 5. sferikon Twitter, GitHub, Gmail, IRC, &c.
  6. 6. Code for America APPLY WITHIN
  7. 7. I’ve committed to...rails oauth2 rvmrails_admin faraday bundermerb_admin thor travis-citwitter multi_json dummy_datatwurl multi_xml git-pullssimple_oauth octokit mlb
  8. 8. HubCap
  9. 9. Who else?@lrz @benstiglitz@merbist @importantshock@rich_kilmer @naixn@alloy @watson1978@vincentisambart @Psychs@macruby macruby-devel
  10. 10. What?
  11. 11. What MacRuby1. A complete implementation of Ruby 1.9
  12. 12. Ruby apps MacRuby apps
  13. 13. DEMO
  14. 14. What MacRuby1. A complete implementation of Ruby 1.92. Allows you to script existing Mac apps3. Allows you to create new Mac apps
  15. 15. Let me tell you a secret...
  16. 16. AppleScript
  17. 17. Objective-C
  18. 18. Ruby Method Invocationobject.method parameter
  19. 19. Objective-C Method Invocation[object method:parameter];
  20. 20. Ruby Array Initialization and Assignmentarray = []
  21. 21. Objective-C Array Initialization and AssignmentNSMutableArray *array =[[NSMutableArray alloc] init];
  22. 22. RubyCocoa
  23. 23. MacRuby Hello Worldrequire hotcocoainclude HotCocoaapplication do |app|  win = window :size => [100,50]  b = button :title => Hello  b.on_action { puts World! }  win << bend
  24. 24. RubyCocoa Hello Worldrequire osx/cocoainclude OSXapp = NSApplication.sharedApplicationwin = NSWindow.alloc.initWithContentRect_styleMask_backing_defer(  [0, 0, 200, 60],  NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask,  NSBackingStoreBuffered, false)win.title = Hello Worldbutton = NSButton.alloc.initWithFrame(NSZeroRect)win.contentView.addSubview(button)button.bezelStyle = NSRoundedBezelStylebutton.title = Hello!button.sizeToFitbutton.frameOrigin = NSMakePoint((win.contentView.frameSize.width / 2.0) - (button.frameSize.width / 2.0),  (win.contentView.frameSize.height / 2.0) - (button.frameSize.height / 2.0))button_controller = Object.newdef button_controller.sayHello(sender)  puts "Hello World!"endbutton.target = button_controllerbutton.action = sayHello:win.displaywin.orderFrontRegardlessapp.run
  25. 25. Java
  26. 26. Objective-J
  27. 27. When?
  28. 28. When MacRuby NOW! Version 0.10Version 1.0 coming soon
  29. 29. When MacRubyMacRuby will be includedwith Mac OS X 10.7 Lion**currently as a private framework :(
  30. 30. Why?
  31. 31. Why MacRuby• You already know Ruby• Use existing Ruby gems• Ruby 1.9.2• No GIL• Multi-threaded generational GC• Fast!
  32. 32. Performance Benchmarks 8 Ruby 1.9 MacRuby 7 6 5 4 3 2 1app_answer app_tarai so_object vm1_ivar_set vm2_proc vm2_zsuper
  33. 33. Average Selling Price$12.00$10.00 $8.00 $6.00 $11.21 $4.00 $2.00 $4.19 $1.57 iPhone iPad Mac
  34. 34. How?
  35. 35. How MacRubymacruby.com
  36. 36. How MacRubyrvm get headrvm install macruby
  37. 37. How MacRubybrew install llvmport install llvm
  38. 38. How MacRubyFree with ADC account atdeveloper.apple.com/tools/xcodeor $4.99 on the Mac App Store
  39. 39. sferikon Twitter, GitHub, Gmail, IRC, &c.

×