Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I package components to use in multiple iPhone app?

Tags:

xcode

iphone

I am working on a number of iPhone development projects and I am starting to refactor code and would like to be able to package it in a library or framework that I can reuse in different xcode projects for different iPhone applications. I looked at the New Project dialog in xcode and the only option I have under iPhone OS is to create an Application. I have also read somewhere in the iPhone SDK documentation that I cannot create my own framework to reuse in different iPhone apps. What is then the best way to package my reusable components? I went over the iPhone SDK documentation and could not find out. I could keep all my reusable classes in a dummy project and link to those source files from other projects (so I would have a single copy of the source to maintain), but that feels very clumsy. Thank you, fxt

like image 734
fxt Avatar asked Feb 26 '09 18:02

fxt


1 Answers

  • Create your common code as a static library.
  • Drag the xcodeproj file into the groups and files section of the project you want to use it in.
  • Update the include path to point to the headers of your static library.
  • In the info pane for the project you want to use the static lib in add it as a direct dependancy.

This process makes it almost as easy to work with as a regular framework.

like image 71
Lounges Avatar answered Nov 15 '22 08:11

Lounges