Question

I am trying to build a library for inclusion in other iOS/Mac OS X projects. I currently have two separate projects that I switch between to build the library. I would like to have one project and two different schemes so that another person in my team can just change the scheme and get the kind of library they want. I would like to avoid having to manually add a new file to each separate project individually when I need to do so. Thoughts?

Was it helpful?

Solution

  1. Open your iOS project.
  2. Choose File > New > Target… from the menu bar.
  3. Click Framework & Library in the OS X section.
  4. Choose the Cocoa Library target.
  5. Enter a name for the OS X version of the library. It must be different than the iOS library name. Example: “MyLibraryOSX”.
  6. Maybe change the type to Static.
  7. Click Finish.
  8. Select your project itself in the Project Navigator.
  9. Click on the new OS X library target in the TARGETS section.
  10. Click on the Build Phases tab.
  11. Open the Compile Sources section.
  12. Note that Xcode automatically created a .m file with the same name as the OS X library target. You may wish to delete this from your project.
  13. Add your library sources to the Compile Sources section.

Xcode normally creates a scheme for the new target automatically. If you have turned “Autocreate schemes” off for this project, you need to choose Product > Manage Schemes… and create (or ask Xcode to autocreate) the scheme for the new target.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top