Skip to content

Commit

Permalink
fix(internal): Lower constraints when retrieving _internal
Browse files Browse the repository at this point in the history
`RUMMonitorProtocol._internal` required that self be the type `Monitor` before creating the DatadogInternalInterface. This was overspecialization and made it hard to mock internal calls. By casting only to `RUMCommandSubscriber` we can more easily create mocks for testing.
  • Loading branch information
fuzzybinary committed Sep 12, 2023
1 parent ae98346 commit 6fcb09c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion DatadogRUM/Sources/RUMMonitorProtocol+Internal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public extension RUMMonitorProtocol {
/// Grants access to an internal interface utilized only by Datadog cross-platform SDKs.
/// **It is not meant for public use** and it might change without prior notice.
var _internal: DatadogInternalInterface? {
guard let monitor = self as? Monitor else {
guard let monitor = self as? RUMCommandSubscriber else {
return nil
}
return DatadogInternalInterface(monitor: monitor)
Expand Down

0 comments on commit 6fcb09c

Please sign in to comment.