Donny
Donny

Reputation: 94

How to import different header file depending some conditions

There're two header files,for example a.h and b.h. And I need to import them into myClass.m depending some conditions.

If(A),then import a.h. If(B),then import b.h.

Coz there's many same definition in a.h and b.h. So I can't import both of them at the same time.

Upvotes: 0

Views: 83

Answers (1)

Evgeniy  Gushchin
Evgeniy Gushchin

Reputation: 681

In case of using different headers for different targets you can use something like this

#ifdef A_STATE
#import "a.h"
#else
#import "b.h"
#endif

where A_STATE can be set as preprocessor macros for target

Upvotes: 3

Related Questions