Skip to content
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

RUMM-1658 Manual instrumentation of SwiftUI actions #661

Merged
merged 3 commits into from
Nov 29, 2021

Conversation

maxep
Copy link
Member

@maxep maxep commented Nov 15, 2021

What and why?

Actionable SwiftUI components such as Button or NavigationLink are rendered in an opaque UIView subclass: CGDrawingView*. The SDK's auto-instrumentation of UIEvents is not able to capture information from the view to accurately log an action event.

Given the SwiftUI api, we have no way of providing an auto-instrumentation of actions so we have to provide a simple way for instrumentation User Actions manually.

*This is not true for all actionable components, Bar buttons or List items are respectively rendered in UIControl and UITableViewCell and are auto-instrumented by the SDK out of the box.

How?

We will provide a SwiftUI.View extension that allows tracking of Tap action by adding simultaneousGesture using a ViewModifier. The Gesture will then send User Actions events through the Global.rum.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference

@maxep maxep force-pushed the maxep/RUMM-1658/swiftui-actions branch from 5b6b501 to 92f32c7 Compare November 15, 2021 14:15
@maxep maxep requested review from ncreated and buranmert November 15, 2021 15:25
@maxep maxep self-assigned this Nov 16, 2021
@maxep maxep force-pushed the maxep/RUMM-1658/swiftui-actions branch from 92f32c7 to 7031b19 Compare November 17, 2021 11:47
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks like a good way 👌. Left one question, but to my SwiftUI understanding it is not possible to make it more "automatic".

@maxep maxep force-pushed the maxep/RUMM-1658/swiftui-actions branch from 7031b19 to 10b819a Compare November 22, 2021 12:31
@maxep
Copy link
Member Author

maxep commented Nov 22, 2021

Actually, I will have to remove the .swipe instrumentation using SwiftUI.DragGesture. During the implementation of integration tests, I've noticed that the simultaneousGesture(_:) is not actually working and act as gesture(_:), so it will block any other interaction in the view.

@maxep maxep marked this pull request as ready for review November 22, 2021 16:24
@maxep maxep requested a review from a team as a code owner November 22, 2021 16:24
@maxep maxep force-pushed the maxep/RUMM-1658/swiftui-actions branch from eab51e5 to 4732170 Compare November 23, 2021 09:16
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 LG! Only wondering if RUMM-1764 is not a problem here - I don't remember the conclusion and if it impacts iOS or only Android.

@maxep
Copy link
Member Author

maxep commented Nov 24, 2021

I don't remember the conclusion and if it impacts iOS or only Android.

IIRC It was concluded that Android will align to iOS by removing side-effect detection on manual instrumentation.

@maxep maxep force-pushed the maxep/RUMM-1658/swiftui-actions branch from 0da46e2 to 283237c Compare November 24, 2021 12:41
@maxep maxep merged commit d71e560 into feature/swiftui Nov 29, 2021
@maxep maxep mentioned this pull request Dec 1, 2021
@maxep maxep deleted the maxep/RUMM-1658/swiftui-actions branch March 6, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants