Skip to content

Commit

Permalink
feat: Change SentryTracedView init transactionName parameter to `vi…
Browse files Browse the repository at this point in the history
…ewName` (#2630)

Changed SentryTracedView init transactionName parameter to viewName.

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
  • Loading branch information
brustolin and philipphofmann authored Jan 23, 2023
1 parent 005bb4c commit f8fc36d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- AttachScreenshots is GA (#2623)
- Gather profiling timeseries metrics for CPU usage and memory footprint (#2493)
- Change SentryTracedView `transactionName` to `viewName` (#2630)

### Fixes

Expand Down
10 changes: 5 additions & 5 deletions Sources/SentrySwiftUI/SentryTracedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public struct SentryTracedView<Content: View>: View {
let name: String
let id: SpanId

public init(_ transactionName: String? = nil, content: @escaping () -> Content) {
public init(_ viewName: String? = nil, content: @escaping () -> Content) {
self.content = content
self.name = transactionName ?? SentryTracedView.extractName(content: Content.self)
self.name = viewName ?? SentryTracedView.extractName(content: Content.self)
id = SentryPerformanceTracker.shared.startSpan(withName: self.name,
nameSource: transactionName == nil ? .component : .custom,
nameSource: viewName == nil ? .component : .custom,
operation: "ui.load")
}

Expand Down Expand Up @@ -77,8 +77,8 @@ public struct SentryTracedView<Content: View>: View {
///
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6.0, *)
public extension View {
func sentryTrace(_ transactionName: String? = nil) -> some View {
return SentryTracedView(transactionName) {
func sentryTrace(_ viewName: String? = nil) -> some View {
return SentryTracedView(viewName) {
return self
}
}
Expand Down

0 comments on commit f8fc36d

Please sign in to comment.