Skip to content

Commit

Permalink
fix method names
Browse files Browse the repository at this point in the history
  • Loading branch information
arriIsHere committed Nov 18, 2024
1 parent e258e58 commit 984b43f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Sources/Honeycomb/Honeycomb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public class Honeycomb {
OpenTelemetry.registerLoggerProvider(loggerProvider: loggerProvider)

installNetworkInstrumentation(options: options)
InstallUINavigationInstrumentation()
installUINavigationInstrumentation()

if #available(iOS 13.0, macOS 12.0, *) {
MXMetricManager.shared.add(self.metricKitSubscriber)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Honeycomb/UIKit/NavigationInstrumentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

private let honeycombInstrumentationView = "@honeycombio/instrumented-view"

public func InstallUINavigationInstrumentation() {
public func installUINavigationInstrumentation() {
UIViewController.swizzle()
}

Expand Down
12 changes: 6 additions & 6 deletions Sources/Honeycomb/UIKit/UIViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
import UIKit

extension UIViewController {
@objc func trace_viewDidAppear(_ animated: Bool) {
@objc func traceViewDidAppear(_ animated: Bool) {
let span = getViewTracer().spanBuilder(spanName: "viewDidAppear").startSpan()
span.setAttribute(key: "title", value: self.title ?? "")
span.setAttribute(key: "animated", value: animated)
span.setAttribute(key: "className", value: NSStringFromClass(type(of: self)))
span.end()
trace_viewDidAppear(animated)
traceViewDidAppear(animated)
}

@objc func trace_viewDidDisappear(_ animated: Bool) {
@objc func traceViewDidDisappear(_ animated: Bool) {
let span = getViewTracer().spanBuilder(spanName: "viewDidDisappear").startSpan()
span.setAttribute(key: "title", value: self.title ?? "")
span.setAttribute(key: "animated", value: animated)
span.setAttribute(key: "className", value: NSStringFromClass(type(of: self)))
span.end()
trace_viewDidDisappear(animated)
traceViewDidDisappear(animated)
}

public static func swizzle() {
let originalAppearSelector = #selector(UIViewController.viewDidAppear(_:))
let swizzledAppearSelector = #selector(UIViewController.trace_viewDidAppear(_:))
let swizzledAppearSelector = #selector(UIViewController.traceViewDidAppear(_:))
let originalDisappearSelector = #selector(UIViewController.viewDidDisappear(_:))
let swizzledDisappearSelector = #selector(UIViewController.trace_viewDidDisappear(_:))
let swizzledDisappearSelector = #selector(UIViewController.traceViewDidDisappear(_:))

guard
let originalAppearMethod = class_getInstanceMethod(self, originalAppearSelector),
Expand Down

0 comments on commit 984b43f

Please sign in to comment.