[SDK-305] Fix build errors in SDK 6.6.4+ with Carthage #994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Carthage builds were failing with
SwiftVerifyEmittedModuleInterfaceerrors when building the SDK with Xcode 16 / Swift 6.2. The errors looked like:This was blocking Superhuman (high-value customer, red health status) from upgrading to 6.6.4+.
Root Cause
When Carthage builds frameworks, it sets
BUILD_LIBRARY_FOR_DISTRIBUTION=YES, which tells Swift to generate.swiftinterfacefiles. These interface files can only reference public types.The issue was that
SendRequestValueandSendRequestErrorwere declared as internal types, but they were being used in return types of protocol methods throughout the SDK. This created a mismatch where the module interface generator couldn't properly expose these types.Solution
Made the following types public in
swift-sdk/Internal/RequestSender.swift:SendRequestValue(typealias)SendRequestError(struct, including all properties and methods)This is the correct fix because these types were already effectively part of the public API through their use in protocol method signatures - we're just making it explicit now.
Verification
Tested the fix in multiple ways:
Direct xcodebuild test: Built the SDK target with
BUILD_LIBRARY_FOR_DISTRIBUTION=YESon both iOS device and simulator SDKs - both succeeded.Actual Carthage build: Created a test Cartfile pointing to the local repo and ran
carthage update --use-xcframeworks --platform iOS. Build completed successfully and generated valid XCFrameworks for bothIterableSDKandIterableAppExtensions.Framework validation: Verified the built frameworks contain valid Mach-O binaries and Swift module files.
The fix is minimal (only changes access modifiers) and doesn't alter any functionality.
Related
Fixes SDK-305
Zendesk Ticket: #253251