Skip to content

Conversation

@sumeruchat
Copy link
Contributor

Problem

Carthage builds with --use-xcframeworks fail on Xcode 26.0.1 (Swift 6.2) with the error:

error: no type named 'Pending' in module 'IterableSDK'

This issue was reported by Grammarly's iOS team who rely on Carthage for dependency management.

Root Cause

When building with Carthage's library evolution mode (BUILD_LIBRARY_FOR_DISTRIBUTION=YES), Swift generates .swiftinterface files to ensure ABI stability. The issue occurs due to:

  1. Pending type visibility: The Pending<Value, Failure> class is defined as internal in swift-sdk/Internal/Pending.swift
  2. Protocol leakage: PushTrackerProtocol (internal protocol) has methods returning Pending<SendRequestValue, SendRequestError>
  3. Public mock implementation: MockPushTracker is a public class that implements PushTrackerProtocol, compiled into the host-app test target
  4. Swift 6.2 interface generation: With the new $NonescapableTypes compiler feature, Swift attempts to export the public API surface of MockPushTracker in the generated .swiftinterface file
  5. Build failure: Since Pending is internal to IterableSDK, it cannot be referenced in another module's public interface, causing the build to fail

Solution

Make the Pending, FailPending, and Fulfill classes public. These classes were already designed with public methods (onSuccess, onError, onCompletion) and are de facto part of the SDK's API since they're returned by various tracking methods.

Changes

  • Made Pending<Value, Failure> class public
  • Made FailPending<Value, Failure> class and its initializer public
  • Made Fulfill<Value, Failure> class public (initializers were already public)

Impact

  • Minimal API surface change: These types were already functionally public through their usage in method return types
  • Fixes Carthage compatibility: Enables proper module interface generation for library evolution builds
  • No breaking changes: Existing code continues to work as-is
  • Improves API clarity: The public visibility now accurately reflects the intended usage of these types

Testing

Verified that the error no longer occurs in Carthage build logs from Grammarly's environment showing the Pending type resolution failure.

Closes SDK-132

@sumeruchat sumeruchat changed the title SDK-132: Fix Carthage build failure with Xcode 26 / Swift 6.2 [SDK-132] Fix Carthage build failure with Xcode 26 / Swift 6.2 Nov 13, 2025
Copy link
Member

@joaodordio joaodordio left a comment

Choose a reason for hiding this comment

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

LGTM

I think the broader issue here is the need our Mocks have of exposing a private method to public, and should they be included in the host-app and other test targets? But that's for another forum to discuss!

Can you please check the failing tests?

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.43%. Comparing base (6e2fdec) to head (70902b7).
⚠️ Report is 900 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #972       +/-   ##
===========================================
- Coverage   85.19%   69.43%   -15.76%     
===========================================
  Files          91      109       +18     
  Lines        6301     8916     +2615     
===========================================
+ Hits         5368     6191      +823     
- Misses        933     2725     +1792     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joaodordio joaodordio merged commit 666b553 into master Nov 20, 2025
12 of 14 checks passed
@joaodordio joaodordio deleted the feature/SDK-132-carthage-fix branch November 20, 2025 11:10
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.

3 participants