Building Universal (fat) framework for an SDK/library: can I reuse frameworks built for XCFramework?

67 views Asked by At

Currently I am only building XCFramework for SDK. I was asked to also create a legacy Universal (fat) framework.

The XCFramework creation includes 2 stages (taking iOS-only build here just to simplify):

  1. Build .framework archives, using the following command with SDK="iphoneos" and SDK="iphonesimulator"
xcodebuild archive \
    -scheme "${SCHEME}" \
    -archivePath "${ARCHIVE_PATH}" \
    -sdk "${SDK}" \
    -configuration "Release" \
    SKIP_INSTALL=NO \
    BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
    clean
  1. And then creating XCFramework with xcodebuild -create-xcframework command, and including both of the frameworks created in step 1.

From what I understand, creation of Universal library includes the same 2 steps: building frameworks, and then packaging them with lipo -create.

So I wonder if building frameworks for Universal (fat) framework is any different than building them for XCFramework? In other words, can I reuse the results of Step 1 above, and only add lipo -create instead of xcodebuild -create-xcframework as a second step? Or are there any different requirements for .framework creation for Universal framework, comparing to XCFramework?

Unfortunately I didn't find any official guide. Thanks in advance.

0

There are 0 answers