Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to mix Swift & Objective-C in a static library? #3

Open
jsorge opened this issue Oct 28, 2020 · 2 comments
Open

How to mix Swift & Objective-C in a static library? #3

jsorge opened this issue Oct 28, 2020 · 2 comments

Comments

@jsorge
Copy link

jsorge commented Oct 28, 2020

First, thank you so much for your blog post. It's been helping me a ton to figure this stuff out.

But I'm curious how I'd go about mixing Swift & Objective-C in a static library. I have a framework that I want to make into a static library that has a private module as well to share code internally between Swift & Objective-C code (so this would require a module.private.modulemap file, which also means I need to make my module map by hand).

I see that on a framework target, the built product has a Modules/module.modulemap file which has a sub-module to expose the Swift generated header to Objective-C like so:

framework module MyFramework {
  umbrella header "MyFramework.h"

  export *
  module * { export * }
}

module MyFramework.Swift {
    header "MyFramework-Swift.h"
    requires objc
}

I'm not sure if there's a way for me to manually make this file to also then have my private module map expose the internal Objective-C to my internal Swift.

If you've got any ideas on how I can proceed here I'd much appreciate it. Thanks again!

@ashislaha
Copy link
Owner

Hey Sorry, I was quite inactive on GitHub. is it resolved?

@jsorge
Copy link
Author

jsorge commented Mar 18, 2021

No worries! I was actually able to get this working by using a static framework instead of a static library. It seems that frameworks in this situation works quite a bit better (at least that's what I'm finding).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants