Hi
I m using cocoapod version :1.0.0
xcode version: 8.1
I created a new project called "NetworkManager" using Swift mix and match approach . As per apple guidelines xcode generated "
I am adding above pod as dependent to client project. When i compile client project i am getting below error
fatal error: 'NetworkManager-Swift.h' file not found
This time the "NetworkManager-swift.h" generated at "/Build/Products/Debug-iphoneSimulator/NetworkManger/NetworkManager.framework/Headers" path.
is there any setting i have to set in podspec of my pod or in main project?
I did not find solution and stucked up from last few days
thank you
Hi @VenuKotha! Are you attempting to import that header from outside of the framework project?
Yes! because i want to access those from my client projectt
I can not share my code so i created sample projects and placed in the below url. I created for just reference and can not execute.
https://github.com/VenuKotha/TestProj.git
https://github.com/VenuKotha/NMObjC.git
https://github.com/VenuKotha/NMSwift.git
Explanation:- "NMSwift" is one of my private pod written in Swift. I want to use this pod as dependent to "NMObjc" project. "NMObjc" is another private pod written in objc. As per apple guidelines if we want to use swift class in ObjC we have to use objective generated interface. So, I added "#import "NMSwift-Swift.h" in one of the file called "MZNetworkManager.m" in "NMObjC" project and Build was success.
Now i am using "NMObjc" as dependent for "TestProj". If I compile "TestProj" given error "NMSwift-Swift.h" file not found error at NMObjc pod
In NMObjc, you should be importing NMSwift using angle brackets like this: #import <NMSwift/NMSwift-Swift.h>. What I see in the project is #import "NMSwift-Swift.h".
Hi Ben,
Thank you very much for your solution. Your solution is successfully working in the reference project but it is not working with my project. After analyze I found one observation is NMObjc project created with Cocoatouch static library template in my project. So it works if I Imported "#import "NMSwift-Swift.h". In this context build is failed at "TestProject".
How can I handle in this case?
Can't I use swift mix and match if one pod is Staticlibrary template and other pod is singleview template?
Ah! For Swift libraries, you have to use the dynamic library template. That's an unfortunate limitation of Swift at this time.
Can you try with the dynamic library template?
Thank you Ben!
@VenuKotha no problem! It sounds like you were able to resolve this issue, so I'm going to close this out. If that's not the case, please feel free to reopen the issue. Have a great day!
I'm having the same issue.
I can build the stand alone project just fine if it has mixed swift/objc files, by just adding the following import to my .h file:
#import "MODULE_NAME-Swift.h"
However, when trying to build a react native app with cocoapods, I get that "MODULE_NAME-Swift.h" cannot be found. For me, it looks like cocoa is not building/generating the .h file. How can I fix this?
Most helpful comment
In NMObjc, you should be importing NMSwift using angle brackets like this:
#import <NMSwift/NMSwift-Swift.h>. What I see in the project is#import "NMSwift-Swift.h".