1 year ago
#319531

Vinod Kumar Singh
Publishing the XCFramework
I want to modularise my codebase to distribute it like third party libraries. I followed the article for the same. So far I have been able to split the code into three modules (Networking, Core & Home). The problem is occurred while archiving the XCFramework with given command - I was facing this error -
:10:8: error: no such module 'Alamofire'
import Alamofire
^
Command CompileSwiftSources failed with a nonzero exit code
** ARCHIVE FAILED **
The following build commands failed:
CompileSwift normal x86_64 (in target 'Networking' from project 'Networking')
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'Networking' from project 'Networking')
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Networking' from project 'Networking')
(3 failures)
So I did some R&D and excluded the arm64 and x86_64 for simulator architecture both from your main Project and the Pod project. Error has gone and archiving was successful. But the xcarchive file created by the command, having only size of 21KB.
Still I tried to generate the XCFramework for simulator and iOS device with the following command -
xcodebuild -create-xcframework \
-framework './build/Networking.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/Networking.framework' \
-framework './build/Networking.framework-iphoneos.xcarchive/Products/Library/Frameworks/Networking.framework' \
-output './build/Networking.xcframework'
As expected, I got the error - "unable to read the file at '/Users/vinodkr/Documents/GitHub/channel-partners-ios/Frameworks/Networking/build/Networking.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/Networking.framework/Networking'"
NOTE :- Device specification
- macOS Monterey, 2.6 GHz 6-Core Intel Core i7
- xcode Version 13.1 (13A1030d)
More Information -
I tried the article with brand new project without Pods in it. It worked perfectly fine.
I am consuming 'Alamofire' with a warning - "Module 'Alamofire' was not compiled with library evolution support; using it means binary compatibility for 'Networking' can't be guaranteed".
ios
swift
xcframework
modularization
0 Answers
Your Answer