XCFramework with Pods Dependencies
You can create a pod and publish it.
Check https://guides.cocoapods.org/making/making-a-cocoapod.html
Sample Podspec file with XCFramework + Third party dependency
Pod::Spec.new do |s|
s.name = 'XCFrameworkTest' # Name for your pod
s.version = '0.0.1'
s.summary = 'Sample Spec'
s.homepage = 'https://www.google.com'
s.author = { 'Sample' => 'sample@sample.com' }
s.license = { :type => "MIT", :text => "MIT License" }
s.platform = :ios
# change the source location
s.source = { :http => 'http://localhost:8080/XCFrameworkTest.zip' }
s.ios.deployment_target = '10.0'
s.ios.vendored_frameworks = 'XCFrameworkTest.xcframework' # Your XCFramework
s.dependency 'PromisesSwift', '1.2.8' # Third Party Dependency
end
After you publish your pod, Customer can use cocopods to get our framework.
In Customer's Podfile
pod 'XCFrameworkTest' #Your pod name
How to create XCFramework for closed source CocoaPod when it has dependencies on other pods
To resolve this, what I did is create a Podfile for the framework project and run pod install
so it has its own workspace. I verified I was able to successfully build the framework in Xcode when opening that workspace. Then to create the archive, specify it should build the workspace rather than the project like so:
xcodebuild archive \
-workspace MyFramework.xcworkspace \
-scheme MyFramework \
-configuration Release \
-destination 'generic/platform=iOS' \
-archivePath './build/MyFramework.framework-iphoneos.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
From what I understand, when you create the XCFramework, the dependencies won't be included it will only be your own framework. But the dependencies have to be accessible in order to successfully build the archive. So this understanding resolves the confusion I had when asking this question. Now I can proceed to create a CocoaPod for my XCFramework and specify its dependencies in the Podspec file.
What should be the Podspec file for using local .xcframework in React Native library?
I was able to fix this issue using:
s.source_files = "ios/*.{h,m,swift}"
s.vendored_frameworks = 'ios/Frameworks/MyLibrary.xcframework'
& also by updating the Framework Search Paths from the Build Settings to $(inherited).
Related Topics
Generating an Unsigned IPA iOS Application
Is It Necessary to Use [Unowned Self] in Closures of Uiview.Animatewithduration(...)
How to Check Where My App Is Using Idfa
Don't Launch Simulator When Running Unittests
Uitextview Link Tap Recognition Is Delayed
Set Background Color of Active Tab Bar Item in Swift
Uicollectionview Registerclass: Forcellwithreuseidentifier Method Breaks Uicollectionview
How to Set Uiviewcontroller "Extend Edges" Properties
How to Draw a Line in Sprite-Kit
Swift 3 Objc Optional Protocol Method Not Called in Subclass
Open Target="_Blank" Links Outside of Uiwebview in Safari
Expand and Collapse Tableview Cells
Avqueueplayer Playback Without Gap and Freeze
How to Change Uibutton Title Color