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

Swift and Modules #15

Open
Numpsy opened this issue Mar 1, 2017 · 3 comments
Open

Swift and Modules #15

Numpsy opened this issue Mar 1, 2017 · 3 comments

Comments

@Numpsy
Copy link
Contributor

Numpsy commented Mar 1, 2017

Related to what i'm trying in #12:

In order to use ObjC frameworks in Swift frameworks, you need to have a module to import (frameworks not having bridging headers as applications do).

As it stands, the Dubrovnik frameworks aren't modules, and making them into modules has a few issues. e.g.
-Mono isn't modular either, so you can get 'non-framework header' type warnings from DBMonoIncludes.h when importing Dubrovnik
-you can't have '.' in the module name, so things like 'Mono.mscorlib' won't work.

I've got it to work by creating a local modulemap file that invents a module for each of the Dubrovnik .frameworks that I need, but it would be nice if there was something more official.

Any thoughts?

@KosmicTask
Copy link
Contributor

Not a clue. But if you can fashion a modulemap file manually could we not put that into the code generator itself or a build phase? I would need to read up on this before I could say anything halfway sensible!

@Numpsy
Copy link
Contributor Author

Numpsy commented Mar 1, 2017

You could probably do something, though i'm still learning the details myself.

fwiw, If i create a modulemap file containing

module Dubrovnik {
    header "DubrovnikModule.h"
    export *
}

where DubrovnikModule.h just includes <Dubrovnik/Dubrovnik.h> then I can import that into Swift and it works, though the 'Dubrovnik' module then ends up containing all of the Mono stuff as well. (I imagine you could do something similar to create a 'Mono' module to avoid that, but I haven't tested that).
I suppose I should be enquiring if theres a chance of Mono.framework getting the required bits officially first ;-)

@KosmicTask
Copy link
Contributor

I would ask on the Mono list. There is a separate project for building the Mono SDK for the mac
https://github.com/mono/bockbuild

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