belozierov / SwiftCoroutine

Swift coroutines for iOS, macOS and Linux.
https://belozierov.github.io/SwiftCoroutine
MIT License
836 stars 51 forks source link

Pure Swift Possible? #8

Closed possen closed 4 years ago

possen commented 4 years ago

This library looks great. I have been trying to integrate it in an XCFramework I have. There is an issue, I am having, because it defines a C module, it turns on "Defines Module" if you turn on "Defines Module" and BUILD_LIBRARIES_FOR_DISTRIBUTION then the SwiftInterface files are not generated for that module. Not sure if this is correct behavior but it is the behavior, none the less.

See this project for an example of the issue (turning off Defines Module lets it generate the swiftinterface files). https://github.com/possen/HostApp. Turning it off, means it won't import in Application because the swiftintface files are missing.

The question becomes is there a way to either not enable "defines module" for the whole project, just that one C module, or do a pure Swift implementation?

belozierov commented 4 years ago

@possen Hi, I tried to create XCFramework for SwiftCoroutine and I succeeded (I tried doing it for macOS):

  1. There was a compile issue when I was creating XCFramework and I fixed it. Please use the code from the last commit on the maser branch.
  2. When I added the XCFramework to a project, the following helped me: make sure that you have a MyFramework.framework file within the same directory as MyApp (https://stackoverflow.com/questions/60078417/embedding-xcframework-in-application-with-project-framework-dependencies)
  3. 'Disable Library Validation'(turn off signing validation) also helped me when I connected to a test project (for macOS).

I'm adding XCFramework for SwiftCoroutine, you can try adding it. Please let me know if this worked for you.

SwiftCoroutine.xcframework.zip

belozierov commented 4 years ago

Also add an example of a working project - Example.zip

possen commented 4 years ago

Great, thanks so much! Will try it out!