refactor: Move MPRokt Swift interop to core SDK for single-import#702
refactor: Move MPRokt Swift interop to core SDK for single-import#702
Conversation
…erience Swift consumers previously needed two imports to access MPRokt APIs that use RoktContracts types: `import mParticle_Apple_SDK` and `import mParticle_Rokt_Swift`. This moves the bridge extensions into the core SDK target so a single `import mParticle_Apple_SDK` provides all MPRokt methods in Swift. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Revert to placeholder keys to pass mparticle-api-key-check lint. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR SummaryMedium Risk Overview Removes the kit-side Swift interop source from the Rokt kit project and updates migration docs and examples to use the original Updates the Rokt kit Reviewed by Cursor Bugbot for commit 01bfd40. Bugbot is set up for automated code reviews on this repo. Configure here. |
📦 SDK Size Impact ReportMeasures how much the SDK adds to an app's size (with-SDK minus without-SDK).
➡️ SDK size impact change is minimal. Raw measurementsTarget branch (main): {"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1880,"with_sdk_executable_size_bytes":76360,"sdk_impact_kb":1796,"sdk_executable_impact_bytes":896,"xcframework_size_kb":6532}This PR: {"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1880,"with_sdk_executable_size_bytes":76360,"sdk_impact_kb":1796,"sdk_executable_impact_bytes":896,"xcframework_size_kb":6532} |
| import mParticle_Apple_SDK_ObjC | ||
| import RoktContracts | ||
|
|
There was a problem hiding this comment.
We shouldn't need these imports here as they are already visible from mParticleAppleSDKExports.swift
Summary
MPRoktSwift bridge extensions from the Rokt Kit (mParticle-Rokt-Swifttarget) into the core SDK (mParticle_Apple_SDKtarget) soimport mParticle_Apple_SDKalone provides all MPRokt APIs in SwiftMPRokt+SwiftInterop.swiftfrom the Kit — no longer needed since the bridge lives in the core SDKeventsinstead ofsubscribeToPlacementEvents) — no API rename neededmainbranchMotivation
After the 9.0 merge, Swift callers needed two imports (
import mParticle_Apple_SDK+import mParticle_Rokt_Swift) to accessMPRoktmethods that useRoktContractstypes (RoktEvent,RoktConfig, etc.). This happened becauseMPRokt.hforward-declares these types, and Swift's ObjC importer can't resolve forward-declared types from another module.The core SDK already
@_exported imports bothmParticle_Apple_SDK_ObjCandRoktContracts, so placing the Swift bridge extension there gives Swift consumers access to all MPRokt APIs with a single import. ObjC consumers are unaffected — the Swift extension methods are not@objcand don't interfere with the ObjC method dispatch.Test plan
xcodebuild buildfor iOS Simulator passes withMPRokt+Swift.swiftin the core SDK targettrunk checkpasses on all modified filesMPRokt+SwiftInterop.swiftimport mParticle_Apple_SDKalone providesselectPlacements,events,globalEvents,registerPaymentExtension,selectShoppableAds