6. Adding a Library Target

The passer_rating function is a tremendous achievement—and hard-won. It plainly has applications beyond that simple command-line tool, so let’s encapsulate its services for use in other programs.

All right, no, it isn’t, but doing so will introduce some important skills. So, you can create a static library (an archive of reusable code) for passer_rating, moving its code from the passer-rating tool into the new library, and linking it back into the tool.

Adding a Target

You don’t need to start a new project to create a library—it’s better if you don’t. Open the passer-rating project in Xcode and click the top entry, representing the project, in the Project navigator. This brings up the Project/Target editor.

Like all ...

Get Xcode 6 Start to Finish: iOS and OS X Development, Second Edition 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.