iosxcode

How to get Xcode to create an .xcframework rather than a .framework?


If you create new project from Xcode (v16) and choose framework, and then build it, it results in a .framework. How do you instead get it to build an .xcframework? When creating the framework project there's no options presented to create one or the other.


Solution

  • An xcframework is an archive of frameworks with different architectures. You should create the framework first and then create the xcframework. An xcframework is somewhat like a fat framework. First, create frameworks for each architecture. Then, create the xcframework by:

        xcodebuild -create-xcframework \
        -framework yourAppSimulator.framework \
        -framework yourAppIOS.framework \
        -output yourApp.xcframework