Hello,
I’m building a Swift-based SDK (using SwiftUI) that will be distributed as a single .xcframework, and consumed by a React Native application. The SDK has multiple internal module dependencies (e.g., Essentials, CoreModels, CoreRepository), each of which is currently implemented as a local Swift Package (SPM).
When I attempt to archive the main SDK framework using xcodebuild archive with BUILD_LIBRARY_FOR_DISTRIBUTION=YES, the archive process fails during SwiftEmitModule for these SPMs. I understand this likely relates to module stability requirements for .xcframework distribution.
My key question:
Is it mandatory to convert all Swift Packages (SPMs) into Xcode framework targets in order to successfully archive and bundle them into a distributable .xcframework?
Or alternatively, is there a recommended approach to make Swift Packages archive-compatible for use in a compiled, closed-source SDK, without converting them into Xcode framework targets?
Awaiting your guidance.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello,
I’ve created a custom SDK from my iOS application to be integrated into another app. The SDK depends on Google Maps and payment gateway libraries.
If I exclude these third-party libraries from the SDK, I encounter multiple errors. However, if I include them, the host app throws errors due to duplicate dependencies, since it already integrates the same libraries.
I understand that third-party dependencies can be downloaded separately by adding them through Swift Package Manager (SPM). However, the issue is that if I exclude these dependencies from my SDK, I get compilation errors wherever I’ve used import GoogleMaps or similar statements in my code.
Could you please guide me — or share documentation — on the correct approach to create an SDK that excludes third-party libraries?
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.