For example, We have a pod 'Dependency3' declared Class A
@interface A : NSObject
- (void)test;
@end
pod 'Dependency1' declared Class B and a category of Class A
@interface B : NSObject
@property (nonatomic, copy) NSString *bText;
@end
@interface A (Dep1)
@property (nonatomic, copy) NSString *aTextDep1;
@end
pod 'Dependency2' declared categories of Class A and B
@interface A (Dep2)
@property (nonatomic, copy) NSString *aTextDep2;
@end
@interface B (Dep2)
- (NSString *)bTextDep2;
@end
And the dependency relations are no problem:
Dependency2 -> Dependency3 & Dependency1
Dependency1 -> Denpendency3
In podfile, we enable some of them's modular_headers
pod 'Dependency1', :path => './Dependency1', :modular_headers => true
pod 'Dependency2', :path => './Dependency2', :modular_headers => true
pod 'Dependency3', :path => './Dependency3'
Now if you use class A and B in main project or in another new pod, compiler will tell you
Definition of 'A' must be imported from module 'Dependency1.A_Dep1' before it is required
This problem will sometimes disappeared after I cleaning build folder and module cache folder.
This simple example is simplified from my case which is found in a large component-based project with objc and swift code.
The most important things is why it happened, maybe the include order of module maps or others? I'd be appreciated if someone can help me.