Migrate from CocoaPods to Swift Package Manager
CocoaPods is no longer supported for integrating the CSQ iOS SDK in your app.
If you stay on CocoaPods, you will stop receiving SDK updates. Migrate to Swift Package Manager to continue receiving new features and fixes.
Before you begin
Section titled Before you begin- Xcode 16.0 or later is required.
- Make sure you have an up-to-date copy of your project in source control before starting.
Migration steps
Section titled Migration steps1. Remove the Contentsquare SDK from your Podfile
Section titled 1. Remove the Contentsquare SDK from your PodfileOpen your Podfile and remove the Contentsquare SDK pod reference:
pod 'ContentsquareSDK'Then run pod install to update your project:
pod install2. Add the Contentsquare SDK via Swift Package Manager
Section titled 2. Add the Contentsquare SDK via Swift Package Manager-
In Xcode, go to
File > Add Packages…. -
Enter the following repository URL:
https://github.com/ContentSquare/apple-sdk.git
-
Set the Dependency Rule to
Exact Version1.10.0.
- Click
Add Package.
3. Add the -ObjC linker flag
Section titled 3. Add the -ObjC linker flagTo ensure the SDK starts correctly, add -ObjC as a linker flag:
- In your target's
Build Settings, search forOther Linker Flags. - Add
-ObjC.
4. Remove leftover SwiftProtobuf dependency
Section titled 4. Remove leftover SwiftProtobuf dependencyIf you previously added pod 'SwiftProtobuf' to work around a known CocoaPods issue, remove that reference from your project. SwiftProtobuf is included automatically via SPM.
Also remove https://github.com/apple/swift-protobuf.git from Package Dependencies if you had added it before SDK version 4.35.1.
5. Build and verify
Section titled 5. Build and verifyBuild your project. If the build succeeds and the SDK initializes correctly, the migration is complete.
If you want to fully remove CocoaPods
Section titled If you want to fully remove CocoaPodsIf you're not using CocoaPods for any other dependencies and want to completely remove it from your project:
- Run
pod deintegratein your project directory. - Delete
PodfileandPodfile.lock. - Open the
.xcodeprojfile directly instead of the.xcworkspace.
Troubleshooting
Section titled TroubleshootingSymbol not found at runtime
Section titled Symbol not found at runtimeIf you see an error like:
dyld: Symbol not found: _OBJC_CLASS_$_...Make sure the -ObjC linker flag is present under Build Settings > Linking > Other Linker Flags for your app target.
Module not found at build time
Section titled Module not found at build timeIf Xcode cannot find the ContentsquareModule import, check that the ContentsquareSDK package is listed under your target's Frameworks, Libraries, and Embedded Content in the General tab.

