-
Notifications
You must be signed in to change notification settings - Fork 118
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
RUM implementation in SwiftUI #339
Comments
Hey @Alexander-techIOS ! Thanks for reaching out 🙂. We plan to support SwiftUI in the future, but I can't give any estimates. Please contact our support so we can track your interest in having SwiftUI compatibility for the iOS RUM SDK 💪. |
+1 |
Hi @ncreated! So I want to know if any feature inside Datadog will work on a SwiftUI app |
Hello @saj11. Our manual instrumentation API offers a UI framework-agnostic variant which will work with Global.rum.startView(key:)
Global.rum.stopView(key:) Network requests (auto)instrumentation will only work if there's a RUM View started, so please make sure that you call |
Hello @ncreated according to the manual instrumentation API you shared, Global.rum.startView(viewController: self) is the way to collect RUM resources. So what I don't understand how would that translate in the absence of a UIViewController in the case of swiftUI, the documentation is not clear when it comes to that. Thank you |
Hello @hs-echkayben 👋. In case of view controller absence, you can use following APIs on dd-sdk-ios/Sources/Datadog/DDRUMMonitor.swift Lines 51 to 69 in b19956c
With that, you can start and stop the view by giving struct ContentView: View {
private let viewKey = "content-view" // must be unique
private let rumViewName = "ContentView"
var body: some View {
// ...
.onAppear {
Global.rum.startView(key: viewKey, name: rumViewName)
}
.onDisappear {
Global.rum.stopView(key: viewKey)
}
}
} |
import SwiftUI
import Datadog
struct FooView: View {
var body: some View {
FooContent {
...
}
.trackRUMView(name: "Foo")
}
}
import SwiftUI
import Datadog
struct BarView: View {
var body: some View {
Button("BarButton") { {
...
}
.trackRUMTapAction(name: "Bar")
}
}
It has been designed to work seamlessly with |
@maxep thanks for the update, this is very helpful! I'm currently integrating I'm curious how does the |
Hey @ferologics! Thanks for using it :) We keep a stack of appeared view to consistently log start and stop view events, the last item of the stack is the visible one, any items below it have appeared but So if we have the following sequence, characteristically of a modal navigation:
The following events will be logged:
|
Hey @maxep Does the above mentioned apis work with the native SwiftUI apps? |
Hi @payal10gupta, You mean apps fully written using SwiftUI? Yes it will, on iOS and tvOS platforms. |
Hey @maxep , Thanks for responding. So far I am able to report the crashes and upload the dSYMs on the portal. There are a few issues that I am facing,
Here is how I'm initializing the datadog,
And using the below code to track the SwiftUI views,
Am I missing something here? |
Hi @payal10gupta, This GH issue is about SwiftUI support in RUM. Session Replay does not yet support SwiftUI, it is on our roadmap so stay tuned! |
RUM implementation in SwiftUI
I have gone through the documentation doesn't mention anything regarding SwiftUI, natively. Is there a way to implement RUM in a native SwiftUI and not UIViewControllerRepresentable?
The text was updated successfully, but these errors were encountered: