I’m building an iOS SDK that is distributed as a binary XCFramework and consumed via Swift Package Manager using a binaryTarget.
What I’ve done so far:
Built the SDK using xcodebuild archive for device and simulator
Created the XCFramework using xcodebuild -create-xcframework
The SDK contains a resource bundle with JSON/config files
The XCFramework is wrapped using SPM (code-only wrapper target)
Currently, the resource bundle exists outside the XCFramework, and the host app needs to add it manually during integration. I want to avoid this and make the SDK completely self-contained.
What I’m trying to achieve:
Embed the resource bundle inside the SDK framework so that each XCFramework slice contains it
Ensure the SDK can load its assets internally at runtime without any host app changes
Questions:
What is the correct way to embed a .bundle inside a framework so it gets packaged into each XCFramework slice during archiving?
Which Xcode build phases or build settings are required for this (e.g., Copy Bundle Resources, SKIP_INSTALL, etc.)?
At runtime, what is the recommended approach for locating and loading this embedded bundle from within the SDK code?
Any guidance or best practices for achieving this would be helpful.