[Swift Package Manager] [Xcode] XCFramework has different behaviour when integrated manually vs SPM

Hey, I found a different behaviour when integrating a XCFramework manually vs with SPM.

When I add the XCFramework directly to Xcode, it recognises it as a XCFramework, and allows me to embedded or not.

When I add a XCFramework via Swift Package Manager to the Xcode project, using a binary target, the Xcode recognises it as a static library, and I can't choose if I want to embedded it or not.

Example: https://github.com/twilio/twilio-video-ios

Is this a bug? Is this related to Xcode or SPM?
Thanks

EDIT: let me give a bit more context.

I'm developing a XCFramework, let's call it MyFramework.
MyFramework depends on TwilioVideo (which is also a XCFramework).

To avoid the problem of nested Frameworks or umbrella Frameworks, I need to integrate TwilioVideo in MyFramework with the option "Do Not Embed".
This way, I will only ship MyFramework, and when someone consume MyFramework, will also need to integrate TwilioVideo.
This is what Apple recommends.

The problem is that when I'm compiling MyFramework integrated with TwilioVideo directly via Xcode or integrated via SPM on Xcode produces different results.

When I integrate TwilioVideo directly on Xcode, it works great, it recognises TwilioVideo as a XCFramework and gives the me option "Do Not Embed", which is the correct behaviour.
When I integrate TwilioVideo on Xcode via SPM, Xcode thinks that TwilioVideo is a static library, which is wrong, and doesn't allow me to choose the option "Do Not Embed".
This means that MyFramework end up being an umbrella framework which is discouraged by Apple.
Check the title "Don’t Create Umbrella Frameworks".
https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/CreationGuidelines.html

Since it produces different behaviours when integrating the same XCFramework directly via Xcode or via SPM, I think this is a bug or some kind of limitation.

  • I am also interested in an answer to this very question. Could not find an answer on the Internet yet, and the behavior is the same with Xcode 13 beta 2.

Add a Comment