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?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
What is the recommended approach for distributing an XCFramework that uses common third-party dependencies (like Google Maps) when client apps may also use the same dependencies, resulting in duplicate symbol conflicts?
I'm developing a closed-source SDK distributed as an XCFramework. My SDK internally uses Google Maps for mapping functionality. However, when clients integrate my XCFramework into their apps that also use Google Maps, we encounter duplicate symbol errors.
What I've Tried:
Static vs Dynamic Linking: Both approaches result in conflicts
Static linking: Google Maps symbols compiled into my binary
Dynamic linking: GoogleMaps.framework bundled with my XCFramework
Build Configuration:
Set "Build Libraries for Distribution" = YES
Tried various linking strategies
Architecture Changes:
Used @implementation_only import
Wrapped code with #if canImport(GoogleMaps)
However, the dependencies still get linked at build time
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.