ObjC AnyPromise and SwiftPackageManager (SPM)
This PR makes AnyPromise available to Objective-C and Swift code when used with SPM.
To achieve this, the PromiseKit package now consists of two targets. PromiseKit and PromiseKitObjC. The existence of PromiseKitObjC is almost irrelevant to the client because a simple #import PromiseKit.h can be used in Objective-C files to get access to AnyPromise. If the client wants to use modules, @import PromiseKitObjC; must be used.
AnyPromise is now defined in Swift and uses the @objc attribute. It's made accessible to Objective-C, by adding the category @interface AnyPromise (ObjC) to it. All ObjC functionality defined in this category, delegates to the Swift AnyPromise.
Additional changes to other files were necessary to make everything work in the PromiseKit Xcode Project and while build as a SwiftPackage. All tests succeeded in the Xcode Project.
As expected, the tests and/or build on Linux failed.
My mistake: Not the Linux-Tests are failing. It's the Pretest and I got irritated by the --generate-linuxmain option....
I tested it with Xcode 10.3 and got the same results as seen here while building with Travis. I currently don't know how to fix this and I don't have the time to further investigate this issue. However it works fine with Xcode 12. So maybe this PR could be used for some a later or special SPM version of PromiseKit. I don't know. Any help for fixing this Issue is greatly appreciated.
Rebase for new CI infrastructure
This is very intrusive. I cannot merge.
Yeah, a lot of changes were necessary to make it work. I’m already using my fork in production code for two of my projects and it works without any problems so far.
I can think of a few simplifications but I don’t know if they work. The main problem is, that SPM does not support mixed code targets. So I had to clearly separate Swift and ObjC into to two targets and adapt the code accordingly.
Let me know what you find most intrusive. Maybe I find a way to change that.
We need to run the full CI against this. I'll make that possible with a comment or something.
I guess we would merge for v6 since v7 is now mainline and we don‘t intend to maintain v6 beyond fixes.
Ideally would be a little less intense though…
Hi,
is there any update about this issue? How is possibile to use AnyPromise in an ObjC class using the SPM version?
Thanks.
is there any update about this issue?
This PR is too much. I have to maintain the results and this is beyond my ability to comprehend it without significant work. So I can't merge it.
How is possibile to use AnyPromise in an ObjC class using the SPM version?
It is not possible without a patch like this. You could use the fork of OP. SwiftPM is decentralized by design.