Chapter 2. Using Macirb and the Apple development tools

 

This chapter covers

  • Loading external libraries
  • Getting to know the MacRuby console
  • Building a Pomodoro application

It’d be a shame if you couldn’t use the many well-written Objective-C and Ruby libraries when writing MacRuby applications. In this chapter, you’ll discover how to leverage these libraries to instantly add functionality to your applications. You have access not only to popular frameworks such as Cocoa but also to many Ruby libraries, which are known as gems. You’ll learn how to load and take advantage of the Cocoa frameworks and MacRuby-compatible gems.

You’ll also learn some ins and outs of using the MacRuby console, Macirb. Built on top of the Ruby console, Irb, Macirb allows you to experiment with any code you write, take advantage of the quick feedback of Ruby’s console, and try out any of the more complicated API calls that you’ll encounter along the way. With Macirb, you can experiment in a much simpler context than what you often find when doing the same in a full application.

Finally, you’ll create your first useful MacRuby application using Xcode and Interface Builder. By the end of this chapter, you’ll have a Pomodoro application that you can release to the world! If you’re not familiar with the Pomodoro technique (www.pomodorotechnique.com), it’s a simple way for people to efficiently manage their time.

Let’s start by learning how external sources can extend MacRuby’s reach.

2.1. Using external libraries with MacRuby

2.2. Exploring Macirb

2.3. Building a Pomodoro application in Xcode

2.4. Summary