Build xcframework using Aggregated Targets in xcode.
Aggregated Targets is used when we need to build multiple targets together somehow.
you can give name like “AggregatedFramework” Change the scheme to “AggregatedFramework” Scheme and then edit scheme. Choose Run tab from the left panel then change the build configuration to release.
Go back and choose “AggregatedFramework” from the targets then choose Build Phases then click on the little + to add a dependency, and choose Grocerybag Framework Target.
Start typing in the script area or copy past from this sample project.
After script part ready choose the AggregatedTarget and run you project. Once it builds successfully check your project directory, you should be able to see a new directory named xcframework which contains your framework and if you look inside you should see both simulator and iphone architectures are in there.
Please follow below steps:
Project target-> Build settings-> BUILD_LIBRARY_FOR_DISTRIBUTION = YES Project target-> Build settings-> Skip Install = NO
Select Framework from target like “Grocerybag” goto Build settings-> BUILD_LIBRARY_FOR_DISTRIBUTION = YES
Now you can darg and drop framework in your project and import when you needed. Check below image for reference:
For further learning you can check below Apple video: https://developer.apple.com/wwdc19/416