Skip to content

feat(ios): declare FronteggSwift via React Native's spm_dependency helper — unblocks multi-target (white-label) workspaces - #99

Closed
airowe wants to merge 1 commit into
frontegg:masterfrom
airowe:feat/podspec-spm-dependency
Closed

feat(ios): declare FronteggSwift via React Native's spm_dependency helper — unblocks multi-target (white-label) workspaces#99
airowe wants to merge 1 commit into
frontegg:masterfrom
airowe:feat/podspec-spm-dependency

Conversation

@airowe

@airowe airowe commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Problem

Since FronteggSwift went SPM-only (1.2.18+), ios/frontegg_spm.rb links it by text-patching the host app's Pods.xcodeproj with hardcoded object IDs sized for a single app target (+ test targets). Workspaces with many app targets can't use it: white-label products build dozens of apps from one workspace, and the script writes references for a target layout that doesn't match. That currently leaves multi-target consumers with no supported integration path.

ios-launch-final-state

Fix

React Native ≥ 0.75 ships an official mechanism for exactly this case: spm_dependency declared in a library podspec, which react_native_post_install applies to every target consuming the pod — one XCRemoteSwiftPackageReference in the Pods project, no pbxproj text manipulation, no per-target work.

This PR declares FronteggSwift that way in FronteggRN.podspec:

  • Guarded by defined?(spm_dependency) because autolinking evaluates the spec via pod ipc spec in a subprocess where react_native_pods.rb isn't loaded — the install-time evaluation (the one that matters) has the helper.
  • On older RN without the helper, the guard makes this a no-op and ios/frontegg_spm.rb remains the documented fallback — no behavior change for existing consumers.
  • Version pinned to match ios/Package.swift (1.3.11 at time of writing; comment notes to keep them in sync — you may prefer generating both from one source at release time).

Validation

Validated on a production workspace with ~50 white-label app targets (RN 0.81.5, CocoaPods static linkage):

  • pod install injects a single package reference (exactVersion), applied by react_native_post_install — verified in the generated Pods.xcodeproj.
  • Debug and Release builds of two app targets with different team/bundle IDs succeed with zero per-target configuration — the exact case the current script cannot handle.
  • App boots through runtime init to the Frontegg embedded login page rendering in the SPM-delivered FronteggSwift WebView (screenshot below).
  • Consumers can commit the workspace-level Package.resolved for revision-exact supply-chain pinning, equivalent to Podfile.lock checksums.

…lper (multi-target workspaces)

ios/frontegg_spm.rb text-patches the host's Pods.xcodeproj with object
IDs sized for a single app target. Workspaces with many app targets
(white-label products build dozens from one workspace) can't use it —
the script writes references for a target layout that doesn't match.

React Native >= 0.75 ships an official mechanism for exactly this:
spm_dependency() in a library podspec, applied by
react_native_post_install to every target that consumes the pod, with
no pbxproj text manipulation. Declare FronteggSwift there, guarded by
defined?() so autolinking's out-of-process [!] A specification path is required.

Usage:

    $ pod ipc spec PATH

      Converts a podspec to JSON and prints it to STDOUT.

Options:

    --allow-root   Allows CocoaPods to run as root
    --silent       Show nothing
    --verbose      Show more debugging information
    --no-ansi      Show output without ANSI codes
    --help         Show help banner of specified command evaluation
(which doesn't load react_native_pods.rb) still parses the spec;
frontegg_spm.rb remains the documented fallback for older RN.

Validated on a 50-target workspace (RN 0.81.5, static linkage):
pod install injects one XCRemoteSwiftPackageReference; Debug and
Release builds of two app targets with different team/bundle IDs
succeed with no per-target configuration.
@dianaKhortiuk-frontegg

Copy link
Copy Markdown
Collaborator

Superseded by #103 — recreated as a Frontegg-owned branch, rebased on current master (post-#100), with the SPM pin aligned to 1.3.12 to match #92 (and ios/Package.swift bumped alongside). Your spm_dependency commit was cherry-picked with authorship preserved, and the full CI suite (Build / Lint | Typecheck / Unit Tests) now runs on it — the checks that didn't exist when this PR was opened. Closing in favor of that branch. Thanks @airowe 🙏

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants