Home > Net >  Regenerate XCFramework if there is a code change
Regenerate XCFramework if there is a code change

Time:07-07

I have a Demo project and Framework which can be integrated with multiple ways(Cocoapods, SPM - using generated XCFramework, directly integrate with XCFramework)

For distributing Demo app to external users we integrate the Framework with SPM.

Problem with this approch is during development its makes really hard to regenerate XCFramework after each change, so I have decided to drag and drop the Framework's project to Demo app, but cant understand how to recompile XCFramework if there is a change. Could you please help me with understading how to handle this scenario.

CodePudding user response:

Create an .xcworkspace that contains the framework project and the demo app project side by side, then inside the demo app target General settings (see screenshot), add the .framework file from the framework project within the workspace instead of depending on the .xcframework binary file directly.

enter image description here

After that, add a "Copy File" build phase that embeds the framework file.

enter image description here

  • Related