Add Swift Package Manager (SPM) support for Flutter-SDK#356
Add Swift Package Manager (SPM) support for Flutter-SDK#356reshab-code wants to merge 13 commits into
Conversation
…imports with guards
…tion with a Classes symlink
…e clevertap.h and clevertapPlugin.h in AppDelegate, remove locale parameter from StyledToast causing build failure
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds Swift Package Manager support to the CleverTap Flutter iOS plugin. Introduces ChangesSwift Package Manager Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ios/clevertap_plugin.podspec`:
- Around line 14-17: The podspec currently pins the CleverTap iOS SDK exactly
(s.dependency 'CleverTap-iOS-SDK', '7.6.0') while Package.swift uses SwiftPM's
from: "7.6.0" range; update the version policy so both package managers
match—either change the podspec dependency to a matching range (e.g., '>= 7.6.0'
or a compatible '~> 7.6.0') to mirror SwiftPM's semantics, or change
Package.swift to pin exactly "7.6.0"; modify the s.dependency line in
ios/clevertap_plugin.podspec or the Package.swift from: entry accordingly so
both use the same constraint.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 377d95db-be1e-42e3-b694-a2d8e0a43aed
📒 Files selected for processing (12)
example/ios/Runner/AppDelegate.mexample/lib/main.dartios/Classes/CleverTapPlugin.mios/Classes/CleverTapPluginCustomTemplates.mios/Classes/include/CleverTapPlugin.hios/Classes/include/CleverTapPluginAppFunctionPresenter.hios/Classes/include/CleverTapPluginCustomTemplates.hios/Classes/include/CleverTapPluginTemplatePresenter.hios/clevertap_plugin.podspecios/clevertap_plugin/Classesios/clevertap_plugin/Package.swiftpubspec.yaml
💤 Files with no reviewable changes (1)
- example/lib/main.dart
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@reshab-code https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors, check for this official docs if our changes follows folder and files structures and names |
# Conflicts: # ios/clevertap_plugin.podspec
|
@coedrabbitai review |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@doc/Integrate-iOS-SPM.md`:
- Line 60: The Markdown headings for the Objective-C and Swift sections are
skipping levels, which breaks the document hierarchy. Update the section
headings identified by Objective-C and Swift to use a consistent intermediate
heading level so they follow the prior subsections instead of jumping from h3 to
h6. This should be applied to both occurrences mentioned in the diff to satisfy
linting and keep the structure readable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 25d4ee61-a799-4855-a661-995eefb1b010
📒 Files selected for processing (13)
doc/Integrate-iOS-SPM.mdios/.gitignoreios/clevertap_plugin.podspecios/clevertap_plugin/Package.swiftios/clevertap_plugin/Sources/clevertap_plugin/CleverTapPlugin.mios/clevertap_plugin/Sources/clevertap_plugin/CleverTapPluginAppFunctionPresenter.mios/clevertap_plugin/Sources/clevertap_plugin/CleverTapPluginCustomTemplates.mios/clevertap_plugin/Sources/clevertap_plugin/CleverTapPluginTemplatePresenter.mios/clevertap_plugin/Sources/clevertap_plugin/include/clevertap_plugin/CleverTapPlugin.hios/clevertap_plugin/Sources/clevertap_plugin/include/clevertap_plugin/CleverTapPluginAppFunctionPresenter.hios/clevertap_plugin/Sources/clevertap_plugin/include/clevertap_plugin/CleverTapPluginCustomTemplates.hios/clevertap_plugin/Sources/clevertap_plugin/include/clevertap_plugin/CleverTapPluginTemplatePresenter.hpubspec.yaml
💤 Files with no reviewable changes (1)
- ios/clevertap_plugin/Sources/clevertap_plugin/CleverTapPluginCustomTemplates.m
✅ Files skipped from review due to trivial changes (1)
- ios/.gitignore
🚧 Files skipped from review as they are similar to previous changes (1)
- pubspec.yaml
|
|
||
| When Flutter resolves the plugin via SPM, the module name changes. Use conditional imports in your `AppDelegate` to support both CocoaPods and SPM builds: | ||
|
|
||
| ###### Objective-C |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix heading level increment.
Both ###### Objective-C and ###### Swift skip levels (h3 → h6). Change to #### Objective-C and #### Swift to satisfy Markdown linting and improve document structure.
📝 Proposed fix
- ###### Objective-C
+ #### Objective-C- ###### Swift
+ #### SwiftAlso applies to: 76-76
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 60-60: Heading levels should only increment by one level at a time
Expected: h4; Actual: h6
(MD001, heading-increment)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@doc/Integrate-iOS-SPM.md` at line 60, The Markdown headings for the
Objective-C and Swift sections are skipping levels, which breaks the document
hierarchy. Update the section headings identified by Objective-C and Swift to
use a consistent intermediate heading level so they follow the prior subsections
instead of jumping from h3 to h6. This should be applied to both occurrences
mentioned in the diff to satisfy linting and keep the structure readable.
Source: Linters/SAST tools
Summary
Adds Swift Package Manager (SPM) support to the CleverTap Flutter plugin iOS layer,
alongside the existing CocoaPods integration. Both package managers are supported
simultaneously — consumers choose based on their project setup.
Changes
pubspec.yaml— AddedswiftPackageName: clevertap_pluginunderios:toenable Flutter's SPM plugin detection
ios/clevertap_plugin/Package.swift— New SPM package manifest declaringCleverTapSDK(≥ 7.6.0) as a dependency with public headers path and search pathsios/clevertap_plugin/Classes/— Symlink pointing to../Classesso the SPMtarget and CocoaPods target share the same source files
ios/Classes/CleverTapPlugin.m— Added__has_includeguards around<CleverTapSDK/CleverTap.h>and<clevertap_plugin/CleverTapPlugin.h>forcompatibility under both build systems
ios/Classes/CleverTapPluginCustomTemplates.m— Same__has_includeguardsfor
CTJsonTemplateProducer.handCTCustomTemplatesManager.hios/clevertap_plugin.podspec— Narrowed public header file patternsNotes
clevertap-ios-sdkat7.7.0(satisfiesfrom: "7.6.0"constraint)below this are auto-promoted with a build log notice
clevertap-ios-sdkdirectly at a future v8 major,SPM will fail with: "Dependencies could not be resolved because root depends on
'clevertap-ios-sdk' 8.0.0..<9.0.0 and 'clevertap_plugin' depends on
'clevertap-ios-sdk' 7.6.0..<8.0.0." — this is expected behavior
Test Results
Build Verification (automated — CI)
flutter build ios --no-codesignsucceedsclevertap-ios-sdk 7.6.0resolved via SPMnmshows no CleverTap duplicatesCleverTapSDK.frameworkpresent in.app/Frameworks/otool -Lconfirms CleverTapSDK dylibIntegration Tests (simulator + staging account)
CleverTap: Initializing...in console, no crashonUserLoginpayload confirmed delivered to dashboardsyncVariables()requires a debug-signed build;syncVariablesinProd(false)unblocks in simulatorCocoaPods Regression (manual)
Podfile.lockshowsCleverTap-iOS-SDK (7.6.0), clean build3.8.1 → 4.0.0viapod update; all existing API calls compile and runSPM Regression (manual)
Package.resolvedshowsclevertap-ios-sdk 7.7.0, clean buildMigration Path Tests (manual)
pod deintegrate+ SPM build succeededpod installrestored CocoaPods build cleanlySummary by CodeRabbit
New Features
Bug Fixes
Documentation