-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REPLAY-1936 Session Replay Objective-C interface #1417
Conversation
This PR is in draft as it contains 2 solutions described above. I'm in favor of solution 2 since it doesn't have any impact on the configuration and gives us interoperability almost for free. |
REPLAY-1936 use interop interface Update SessionReplayConfiguration.swift
1642329
to
db577e5
Compare
Datadog ReportBranch report: ✅ |
The fact that we can't test code decorated with: @objc(DDSessionReplay) @available(swift, obsoleted: 1) breaks the main promise behind the idea of using it.
There is a large risk in this approach hidden in the fact that we blend both interfaces into one. The more powerful Swift interface will be constrained by features only available in Swift <> Objc interoperability. It means we won't be able to use enums with associated values, I understand that the simplistic SR interface is not a problem for All that said, I believe that defining SR in |
Thanks, @ncreated !
I don't consider this a risk but a constraint. Any public var attributes: [String: Encodable] = [:]
@objc(attributes)
public var objc_attributes: [String: Any] = [:] {
didSet { attributes = objc_attributes.mapValues(AnyEncodable.init) }
} Duplicating interfaces in a separate module is more maintenance cost than complying to swift/objc interoperability from the main api, especially for such simple interface. I'm aware that the product will grow in complexity, but nothing we can't overcome with an interop api. In RUM for example, we would have to use wrappers for some structs and I understand that this proposal differs from the current (intermediary) state of the objc interfaces, and I agree to continue exposing it in |
Closing in favor of #1419 |
@maxep Indeed, that seems to be fair proposal and I like it 👍. However, there are still things to define on top of it, e.g.: should we go "interop if possible" or "Swift first, interop as extension". Both could shape the codebase differently depending on implementation guidelines (e.g. dictate no use of
💯 🎯 |
What and why?
Expose Session Replay to Objective-C.
Fix #1387
How?
This PR includes 2 proposals:
1. Additional Interface f607fd5
Pretty much like the
DatadogObjc
module,DatadogSessionReplay
will expose specific objects that support interoperability, see the following example:It's using the
@available(swift, obsoleted: 1)
annotation to only expose those to objc.This solution has 2 main drawbacks:
2. Single Interop Interface 6aadf46
By doing so, we remove the duplication in wrappers and fully leverage Swift/Objective-C interoperability.
It's made possible by the following facts:
SessionReplay
is not instantiable and only expose static method.SessionReplayConfiguration
can be mutated freely before enabling the Feature, the instance is never retained.Review checklist
Custom CI job configuration (optional)