Skip to content

Add SPM support for iOS dependencies#916

Open
rickvdl wants to merge 6 commits into
mainfrom
rickvdl/spm-support
Open

Add SPM support for iOS dependencies#916
rickvdl wants to merge 6 commits into
mainfrom
rickvdl/spm-support

Conversation

@rickvdl
Copy link
Copy Markdown
Member

@rickvdl rickvdl commented May 1, 2026

Description

CocoaPods is being deprecated. EDM4U 1.2.187 (Jan 2026) added Swift Package Manager support for iOS dependencies, so this PR offers SPM as a path forward.

  • Declare PurchasesHybridCommon and PurchasesHybridCommonUI as <remoteSwiftPackage> entries in both RevenueCatDependencies.xml and RevenueCatUIDependencies.xml, alongside the existing <iosPods> entries.
  • Use replacesPod so EDM4U strips the matching pods at resolve time when SPM is honored.
  • Drop a redundant #import <PurchasesHybridCommonUI/PurchasesHybridCommonUI-Swift.h> from RevenueCatUI.m — the @import PurchasesHybridCommonUI; already exposes the same @objc symbols via Clang modules, and the angle-bracket header doesn't exist under SPM. Matches the pattern used in purchases-flutter.
  • Bump EDM4U in the Subtester to 1.2.187 and toggle SwiftPackageManagerEnabled on by default so contributors test SPM going forward.
  • Update the update_hybrid_common fastlane lane to also bump the SPM version, so future PHC bumps don't silently leave SPM pinned at an old version.
  • Split build-integration-tests-ios and archive-ios into parameterized jobs that run in parallel — one variant per dependency manager — so both paths stay covered in CI.

Customer impact

Existing CocoaPods customers are unaffected. EDM4U < 1.2.187 silently ignores the new <remoteSwiftPackage> element and falls through to the existing <iosPod> entries, so their builds continue working unchanged.

SPM is opt-in for now. Customers who want SPM need to update EDM4U to 1.2.187+ and enable the "Swift Package Manager Enabled" toggle in iOS Resolver settings. Once enabled, the `replacesPod` mechanism removes the pods from the generated Podfile and adds `purchases-hybrid-common.git` as an SPM dependency to the Xcode project.

Testing

Verified locally in the Subtester on a real iOS device, both with and without the SPM toggle enabled — CocoaPods and SPM both build and run successfully.

CI runs both paths in parallel and both archived cleanly. Verified the dependency manager actually used by inspecting the xcodebuild logs:

  • archive-ios-cocoapods — pulled PHC + PHC UI via CocoaPods.
  • archive-ios-spm — resolved via Swift Package Manager:
    Resolved source packages:
      PurchasesHybridCommon: https://github.com/RevenueCat/purchases-hybrid-common.git @ 18.2.0
      RevenueCat: https://github.com/RevenueCat/purchases-ios-spm @ 5.69.0
    resolved source packages: PurchasesHybridCommon, RevenueCat
    

Required status checks (follow-up)

To avoid breaking branch protection, the SPM variants reuse the original job names (build-integration-tests-ios and archive-ios) — only the CocoaPods variants get explicit -cocoapods suffixes. The existing required checks keep working unchanged.

As a follow-up after merge, we should add build-integration-tests-ios-cocoapods and archive-ios-cocoapods to the required status checks list so the legacy path stays gated until we drop CocoaPods support entirely.

@rickvdl rickvdl added the pr:feat A new feature label May 1, 2026
@rickvdl rickvdl marked this pull request as ready for review May 1, 2026 13:47
@rickvdl rickvdl requested a review from a team as a code owner May 1, 2026 13:47
Copy link
Copy Markdown
Member

@ajpallares ajpallares left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this!!

I have some comments. But my biggest concern is that the PR description mentions that using SPM is opt-in, while EDM4U 1.2.187 does this in its IOSResolver.cs

public static bool SwiftPackageManagerEnabled {
    get { return settings.GetBool(PREFERENCE_SWIFT_PACKAGE_MANAGER_ENABLED,
                                  defaultValue: true); }
    ...
}

which seems to mean that SPM is now enabled by default?

In fact, on CI, build-integration-tests-ios is actually disabling SPM, so it seems to be opt-out.

Comment thread .circleci/config.yml
Comment on lines +417 to +419
key: 1-pods-<< parameters.variant >>-{{ checksum "RevenueCat/Plugins/Editor/RevenueCatDependencies.xml" }}
paths:
- IntegrationTests/buildiOS/Pods
- IntegrationTests/buildiOS-<< parameters.variant >>/Pods
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any point in restoring/saving the /Pods cache when variant is spm?

Comment thread .circleci/config.yml
Comment on lines 411 to 414
- run:
name: Install Pods
working_directory: IntegrationTests/buildiOS
working_directory: IntegrationTests/buildiOS-<< parameters.variant >>
command: bundle exec pod install --repo-update --verbose
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this step be skipped when variant is spm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants