Nimble icon indicating copy to clipboard operation
Nimble copied to clipboard

No Objective C support in SwiftPM

Open GLinnik21 opened this issue 3 years ago • 2 comments

  • [ ] I have read CONTRIBUTING and have done my best to follow them.

What did you do?

Added Nimble to Obj-C project with SPM. Added @import Nimble;

What did you expect to happen?

Nimble function to be visible from Obj-C

What actually happened instead?

It seems that no files from NimbleObjectiveC folder are actually included to SwiftPM, so there is nothing visible from Obj-C:

Implicit declaration of function 'expect' is invalid in C99
Implicit declaration of function 'equal' is invalid in C99

Environment

List the software versions you're using:

  • Nimble: 10.0.0
  • Xcode Version: 13.4.1 (13F100) (Open Xcode; In menubar: Xcode > About Xcode)
  • Swift Version: Xcode Default (Open Xcode Preferences; Components > Toolchains. If none, use Xcode Default.)

Please also mention which package manager you used and its version. Delete the other package managers in this list:

  • Swift Package Manager 5.6.0 (swiftpm-???) (Use swift build --version in Terminal)

GLinnik21 avatar Jul 27 '22 11:07 GLinnik21

Hey @GLinnik21! Thanks for the issue! We'll take care of this and make sure we support Objective-C on the Swift Packages release in the next version of Nimble.

For now, Carthage and Cocoapods both support Objective-C, but I understand that it's a little extra work to get those working with xcode.

younata avatar Aug 03 '22 18:08 younata

I also just ran into this issue. Would love to see objc support when used via SPM.

headlessme avatar Sep 21 '22 16:09 headlessme

I spent some time spiking this out today. Part of the issue is that Swift PM doesn't support mixed-source targets (can't mix swift and objective-c). So we'd have to ship a separate framework for the objective-c support. ~~I might bump this to the next version of Nimble.~~

Found some time this evening to set this up. I would deeply appreciate feedback on it to double check this meets your needs!

younata avatar Oct 21 '22 05:10 younata

Bumping this to the next release in favor of getting async/await support out the door sooner.

younata avatar Oct 31 '22 21:10 younata