• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,134
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
14
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. GUI Programming withMacRuby
  • 2. GUI Programming with MacRubyWho?What?When?Where?Why?How?
  • 3. Who?
  • 4. Erik Michaels-Ober?
  • 5. sferikon Twitter, GitHub, Gmail, IRC, &c.
  • 6. Code for America APPLY WITHIN
  • 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. HubCap
  • 9. Who else?@lrz @benstiglitz@merbist @importantshock@rich_kilmer @naixn@alloy @watson1978@vincentisambart @Psychs@macruby macruby-devel
  • 10. What?
  • 11. What MacRuby1. A complete implementation of Ruby 1.9
  • 12. Ruby apps MacRuby apps
  • 13. DEMO
  • 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. Let me tell you a secret...
  • 16. AppleScript
  • 17. Objective-C
  • 18. Ruby Method Invocationobject.method parameter
  • 19. Objective-C Method Invocation[object method:parameter];
  • 20. Ruby Array Initialization and Assignmentarray = []
  • 21. Objective-C Array Initialization and AssignmentNSMutableArray *array =[[NSMutableArray alloc] init];
  • 22. RubyCocoa
  • 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. 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. Java
  • 26. Objective-J
  • 27. When?
  • 28. When MacRuby NOW! Version 0.10Version 1.0 coming soon
  • 29. When MacRubyMacRuby will be includedwith Mac OS X 10.7 Lion**currently as a private framework :(
  • 30. Why?
  • 31. Why MacRuby• You already know Ruby• Use existing Ruby gems• Ruby 1.9.2• No GIL• Multi-threaded generational GC• Fast!
  • 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. 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. How?
  • 35. How MacRubymacruby.com
  • 36. How MacRubyrvm get headrvm install macruby
  • 37. How MacRubybrew install llvmport install llvm
  • 38. How MacRubyFree with ADC account atdeveloper.apple.com/tools/xcodeor $4.99 on the Mac App Store
  • 39. sferikon Twitter, GitHub, Gmail, IRC, &c.