tags:

views:

292

answers:

2

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

+2  A: 

Unfortunately Apple does not allow frameworks for the iPhone development at this stage. You can either bundle your code in a static library or just the source files in such a way that can easily use them in multiple projects.

I use SVN and keep my reusable code in repositories so that I can easily include them in new projects as externals

nduplessis
+4  A: 
  • 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.

Lounges