Implement the Classes of Currency Converter

The final step in building the Currency Converter application is to implement the classes you defined in the previous steps.

Generate the Source Files

  1. Go to the Classes display of the nib file window.

  2. Select the ConverterController class.

  3. Choose Create Files from the Classes menu.

  4. Verify that the checkboxes in the Create column next to the .h and .m files are selected.

  5. Verify that the checkbox next to Currency Converter is selected.

  6. Click the Choose button.

  7. Repeat for the Converter class.

  8. Save the nib file.

Now we leave Interface Builder for this application. You’ll complete the application using Project Builder.

Examine an Interface (Header) File in Project Builder

When Interface Builder adds the header and source files to the Currency Converter project, it tries to put them in the same group folder as other source files in the same disk folder. Since the newly created files are class implementations, move them to the Classes group if Interface Builder did not do so automatically.

  1. Click Project Builder’s main window to activate it.

  2. Select all four files in the Groups and Files list and drag them into the Classes group, as shown in Figure 7.23.

    Adding the source files to the Classes group

    Figure 7-23. Adding the source files to the Classes group

Add a Method Declaration

You can add instance variables or method declarations to a header file generated by Interface Builder. This is commonly ...

Get Learning Cocoa now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.