We have a suite of apps which share a set of common screens. Some screens have use more functionality in some apps than others. For example, in one app our issue screen supports tags, but in the others it doesn't. In one, our regions screen supports workflows, but in the others it doesn't.
We're using core data, and the different apps have different data models; If an entity isn't used by an app's data model, the corresponding class doesn't get built into that app.
The result of this is that some of our controllers contain references to classes that may or may not exist when the controller is used in a particular app. At the moment, we get around this using "magic" #defines in our apps' PCH files; so some code in our Issue controller is wrapped in #ifdef SGB_ISSUES_HAVE_TAGS
and some code in our Regions controller is wrapped in #ifdef SGB_REGIONS_ARE_FILTERED_BY_WORKFLOW
.
What I'd like is to do this instead by detecting whether a file has been included in the project. So at the top of our Issue controller I'd have something like this:
#if exists_in_project("SGBIssueTag.h")
#import "SGBIssueTag.h"
#endif
and then I could put #ifdef SGB_ISSUES_HAVE_TAGS
into SGBIssueTag.h; any app we built that used the issue controller would get the issue tag functionality as soon as we included the IssueTag entity, and we wouldn't have to mess around with the PCH file.
Is anything like this possible?