Well, I want to know how to move some parts of framework from objective-c to swift without big pain
Ok, as far as I know:
1) Any project not a framework.
- You make
Swift-Bridging-Header.h
orCatsAndGuns-Bridging-Header.h
and put in it many import items. - You assure yourself in Build Settings -> (Search Swift) -> Objective-C Bridging Header. And put here your name.
- Also check Packaging -> Defines Modules -> Yes
2) Framework
Well, you want to develop framework with mix objective-c and swift together.
And here you have pain: you can't use bridging headers in framework targets.
So, you come to google or documentation and start to read. Documentation
Ok, now you feel free and gorgeous about your knowledge, but.. you still don't know how to do it.
- Create umbrella header and name it:
YourProjectName-Swift.h
.CatsAndGuns-Swift.h
, ok. - Make it visible to framework level, so, navigate to right bar and put
target membership -> your_framework_target (CatsAndGuns.framework in my case, of course) -> Public
- And everything should be ok? remember to put every import as:
#import <CatsAndGuns/Rocket.h>
Ok, let's check Rocket.h file in our framework. it is a Project-visible file, so, can it be accessed via in umbrella header (oh, module-swift.h
) or not?
Now I have:
- No bridging header in project ( as i understand from answer )
- Manually created umbrella header with project-visible
Rocket.h
:#import <CatsAndGuns/Rocket.h>
- errors in swift class that it can't see objective-c declarations.
- Product module name without spaces.