0

I want to create a project with a handful of categories that add useful functionality to UIKit. I want to keep this as a separate project so that it can be source-controlled separately (and eventually hosted on github, and downloadable as a dependency via cocoa pods...but let's skip this for now.)

But all the Xcode 6.1 project templates imply an app inside. When I select an empty project it complains about missing base SDK. But this cannot be set without a target present. It is quite confusing. I don't need a target. Do I? The project should be just a shell for a number of categories + a accompanying summary header file.

I want to be able to drag this project as a subproject to any other proper app project, import the summary header file and expose those categories to the main project.

Any advice?

yonderboy
  • 43
  • 1
  • 2
  • 7
  • 1
    Write it as `static library` or `framework` – Azat Apr 25 '15 at 17:37
  • possible duplicate of [Sharing classes between projects in xcode/objective-c](http://stackoverflow.com/questions/2126391/sharing-classes-between-projects-in-xcode-objective-c) – stevesliva Apr 25 '15 at 17:45

1 Answers1

3

You need a target. Every source file that should be compiled must be a part of a target.

You could reference each source file from the target(s) in your app's Xcode projects, but that'd be tedious as you'd have to add to every project manually when you add source to your shared repository.

Either create an embedded framework project or a static library. Unless you are really going to share code between an app and an app's extension, go with the static library. It is a lot easier to manage.

Create a project that has a static library target, add the files to that static library.

Then create a workspace that has your static library project and your app(s) project(s) in it. Modify the app targets to link against the static library.

bbum
  • 162,346
  • 23
  • 271
  • 359