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

[SR-14575] Frameworks built from Swift packages lack a Headers folder #4430

Closed
swift-ci opened this issue May 3, 2021 · 5 comments
Closed
Labels

Comments

@swift-ci
Copy link
Contributor

swift-ci commented May 3, 2021

Previous ID SR-14575
Radar None
Original Reporter xy (JIRA User)
Type Bug
Status Reopened
Resolution
Environment

Xcode 12.5/Swift 5.4

Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: d1fef8db1659268b03d58ce70e8c5b8c

blocks:

  • SR-13075 Swift Package that has @objc in Swift code causes Objective-C module failure with transitive depdency
  • SR-14381 @objc & @objcMembers attributes break compilation on Windows

Issue Description:

When a Swift package Foo declares a dynamic library product for a Swift target Foo that declares some @objc protocols and classes, building that package should result in a framework Foo.framework that has a headers folder Foo.framework/Headers/ containing auto-synthesized Foo.h that includes Foo-Swift.h. That way, Xcode projects with Obj. C code can simply link to Foo.framework and use any @objc code declared therein.

However the current version of SPM fails to add this Headers folder, resulting in any @objc APIs in Foo being invisible to Obj. C code in any modules that link to Foo.framework.

This seems like it should be easy to rectify...

@swift-ci
Copy link
Contributor Author

swift-ci commented May 3, 2021

Comment by Jonathan Gilbert (JIRA)

Note: I confirm this is fixed in Xcode 12.5 / Swift 5.4 toolchain.

@swift-ci
Copy link
Contributor Author

swift-ci commented May 3, 2021

Comment by Jonathan Gilbert (JIRA)

Fixed in 5.4

@swift-ci
Copy link
Contributor Author

Comment by Jonathan Gilbert (JIRA)

Nevermind, it's actually NOT fixed in Swift 5.4.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
@liyirui-git
Copy link

liyirui-git commented Jun 10, 2022

Hi, did this bug fixed now? Any milestones?

@neonichu
Copy link
Member

The current behavior is intentional here. Frameworks produced for packages in Xcode are not meant for further consumption at build time, they are merely meant for being included for use at runtime by other built products, like apps.

This is because there is an impedance mismatch between frameworks and package products because the former always contains a single module and the later can contain more than one.

@neonichu neonichu closed this as not planned Won't fix, can't repro, duplicate, stale Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants