Xcode - import another header file with the same name based on Target

I have a project with several goals, each of which builds quite similar versions of the application, but with different image objects and plists. For plists / images that are fine, but I use ShareKit and Appirater frameworks that have C # defines header files to configure them. For each version, it seems to me, you need to import a different version of this header file, since for each application built by each goal, different settings.

So goal A has SHConfig.h and goal B has DIFFERENT SHConfig.h

I could edit the source for these frameworks to import different headers based on the target, but that would be dirty when I start updating the frameworks.

Is there a better way to import different header files (with the same name) based on the target?

+5
source share
3 answers

Assuming they are in different directories, specify the heading search paths for each target in order to put the correct directory first.

You might want to install it somehow $(SRCROOT)/foo:$(HEADER_SEARCH_PATHS), although I'm not sure if this is necessary.

+5
source

What I found useful is to specify the name of the shared directory in the header search path, and then use a different #import. My directory structure was Common / Views / v1 and Common / Views / v2. I need v1 for one purpose and v2 for another.

, , :

$(SRCROOT)/../Common/

:

#import <Views/v2/ActivityIndicator.h>

, ( $(SRCROOT)/../Common/Views/v2/ActivityIndicator.h).

, (, ) , . I.e.,

#import "ActivityIndicator.h"

, $(SRCROOT)/../Common/Views/v1/ActivityIndicator.h

0

" " → " " → "" → "" ( ) → , . ( "").

. Xcode 10.2

0

All Articles