Using a Swift Package in a mixed Swift and Objective-C project

Hello,

I apologize in advance if this question has been asked before (I searched the forum but did not find anything).

On a brand new project, I created swift sources and Objective-C sources and made sure they worked together. I then proceeded to create a new local Swift Package in Xcode 11 beta 4 with a single Swift file that defined a NSObject subclass with a string inside.
When I tried to use the package class from the project Swift code, it went fine, as expected, after importing the module. I then tried using the package class from the project Objective-C code and no matter what, I could not make it work.

Is this expected behavior? If so, why? And why doesn't a '#import "Package-Swift.h"' or 'import <Package/Package-Swift.h>' in the .m file where I want to use the package code solve the problem?

Thank you for the clarification.

This is a known issue. You can't import a Swift package target into an Objective-C target right now.

Thank you for the quick response.
Is there a Jira ticket that we can follow regarding a future implementation of this feature? Is there a timeframe for it?

1 Like
Terms of Service

Privacy Policy

Cookie Policy