You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Document MPRoktEvent → RoktEvent type change in events method migration (#704)
* docs: Update events method migration to document MPRoktEvent → RoktEvent type change
The events:onEvent: callback parameter type changed from MPRoktEvent to
RoktEvent (from RoktContracts) but the migration guide didn't reflect this.
Add before/after examples for both ObjC and Swift, and note that all MPRokt
methods are now directly accessible without a separate interop import.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: Add import changes section for ObjC RoktContracts and Swift single-import
ObjC callers need `@import RoktContracts;` to use RoktEvent types in
onEvent callbacks. Swift callers only need `import mParticle_Apple_SDK`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: MIGRATING.md
+56-8Lines changed: 56 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -340,6 +340,29 @@ The `MPRokt` interface has been updated to align with the Rokt SDK 5.0.x API. Th
340
340
- A new `globalEvents:` method has been added for subscribing to global Rokt events
341
341
- New `registerPaymentExtension:` and `selectShoppableAds:` methods have been added for Shoppable Ads support
342
342
343
+
#### Import Changes
344
+
345
+
Since event types now come from the `RoktContracts` library instead of the SDK itself, the import requirements have changed:
346
+
347
+
**Objective-C:**
348
+
349
+
Objective-C callers must add `@import RoktContracts;` to access `RoktEvent` types (e.g., `RoktPlacementReady`, `RoktShowLoadingIndicator`) used in the `onEvent:` callbacks:
350
+
351
+
```objective-c
352
+
@import mParticle_Apple_SDK_ObjC;
353
+
@import RoktContracts;
354
+
```
355
+
356
+
**Swift:**
357
+
358
+
A single import provides access to all `MPRokt` methods and `RoktEvent` types — no additional imports are needed:
359
+
360
+
```swift
361
+
importmParticle_Apple_SDK
362
+
```
363
+
364
+
> **Note:** In previous betas, Swift callers needed a second `import mParticle_Rokt_Swift` to access MPRokt APIs that use `RoktContracts` types. This is no longer required.
Note: The method signature remains the same, but the parameter name has changed from `placementId:` to `identifier:`. If you're using named parameters, update accordingly.
459
482
460
-
##### events Method (Swift)
483
+
##### events Method
484
+
485
+
The `events:onEvent:` method name is unchanged, but the callback parameter type has changed from `MPRoktEvent` to `RoktEvent` (from the `RoktContracts` library). This aligns with the same event types used by `selectPlacements:onEvent:` and the Rokt SDK directly.
In Swift, `events(_:onEvent:)` is not directly importable due to the `RoktEvent` block parameter. Use the `subscribeToPlacementEvents(_:onEvent:)` interop method instead.
if ([event isKindOfClass:[RoktPlacementReady class]]) {
500
+
// Handle placement ready
501
+
} else if ([event isKindOfClass:[RoktPlacementClosed class]]) {
502
+
// Handle placement closed
503
+
}
504
+
}];
505
+
```
463
506
464
507
**Before (Swift):**
465
508
466
509
```swift
467
-
MParticle.sharedInstance().rokt.events("checkout") { event in
510
+
MParticle.sharedInstance().rokt.events("checkout") { (event: MPRoktEvent) in
468
511
// Handle event
469
512
}
470
513
```
471
514
472
515
**After (Swift):**
473
516
474
517
```swift
475
-
MParticle.sharedInstance().rokt.subscribeToPlacementEvents("checkout") { event in
476
-
// Handle event
518
+
MParticle.sharedInstance().rokt.events("checkout") { event in
519
+
switch event {
520
+
caseis RoktEvent.PlacementReady:
521
+
// Handle placement ready
522
+
caseis RoktEvent.PlacementClosed:
523
+
// Handle placement closed
524
+
default:
525
+
break
526
+
}
477
527
}
478
528
```
479
529
480
-
> **Note:** Objective-C callers are unaffected — `events:onEvent:` remains available in ObjC unchanged.
481
-
482
530
##### New globalEvents Method
483
531
484
532
The new `globalEvents:` method allows you to subscribe to global Rokt events from all sources, including events not associated with a specific view (such as `InitComplete`).
@@ -530,7 +578,7 @@ In Objective-C, use the flat class name; in Swift, use the nested form `RoktEven
530
578
-`RoktEmbeddedSizeChanged` provides `identifier` and `updatedHeight` properties
0 commit comments