Can an xcframework embed an xcframework?

During the WWDC session that introduces the new xcframework format, there were several slides that imply that an App can embed an xcframework that itself embeds an xcframework.


App -> Framework A -> Framework B


(A screenshot from the session)

https://i.imgur.com/yBLDWHZ.png


When I've attempted to build out this set of dependencies, I'm still required to tell my App about Framework B.


Is there any way to fully embed/include Framework B into Framework A so that the App doesn't need to know about it?

Accepted Reply

Keep in mind that macOS is the only one of our platforms that supports nested frameworks. Most folks who go to the trouble of creating an XCFramework do so because they want to support multiple platforms, so nesting is off the table [1].

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

[1] It’d be cool if the XCFramework supported nested but then Xcode had the smarts to flatten it when building for platforms that don’t support it. I checked with DTS’s tools expert (one of the reasons it took me so long to respond) to see if it Xcode has such smarts. It does not, although I think that’d be a reasonable enhancement request.

  • Is this still true in 2023 that creating umbrella iOS xcframeworks is not possible/not recommended?

  • Is this still true in 2023 that creating umbrella iOS xcframeworks is not possible/not recommended?

Add a Comment

Replies

Keep in mind that macOS is the only one of our platforms that supports nested frameworks. Most folks who go to the trouble of creating an XCFramework do so because they want to support multiple platforms, so nesting is off the table [1].

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

[1] It’d be cool if the XCFramework supported nested but then Xcode had the smarts to flatten it when building for platforms that don’t support it. I checked with DTS’s tools expert (one of the reasons it took me so long to respond) to see if it Xcode has such smarts. It does not, although I think that’d be a reasonable enhancement request.

  • Is this still true in 2023 that creating umbrella iOS xcframeworks is not possible/not recommended?

  • Is this still true in 2023 that creating umbrella iOS xcframeworks is not possible/not recommended?

Add a Comment
Is this reply still accurate? Our clients and their clients would love to be able to nest our tvOS xcframeworks. Hard to build out a good commercial ecosystem if other binary distributions can't include our binary distributions. Maybe I'm misunderstanding something? Any clarity would be greatly appreciated


Agreed with @raisins9123. I'm also wondering if that is still not possible. Thanks!

What is the real technical reason(s) why non-macOS platforms don't support nested frameworks? Being able to supported nested frameworks in iOS & tvOS would make my life as a framework developer a lot easier.

With nested frameworks, I believe I used to get something like "ERROR ITMS-90205: "Invalid Bundle. The bundle at 'yourapp.app/Frameworks/A.framework' contains disallowed nested bundles."..." when submitting the Appstore build to Apple.

However, with XCFrameworks this doesn't seem to be the case anymore? Unless I embed and sign in the xcframework within my framework, it fails to run on device. It might fix the issue if I link and embed and sign on the main app, but validating the binary with xcrun altool --validate-app succeeded with nested xcframework. I verified that the succeeded binary does not have the "Frameworks" folder within the frameworks folder that was embedded, so maybe XCFrameworks doesn't create a nested "Frameworks" folder anymore.