diff --git a/Sources/EmbraceCommonInternal/Swizzling/EmbraceSwizzler.swift b/Sources/EmbraceCommonInternal/Swizzling/EmbraceSwizzler.swift index 58ef1ddb..26a21312 100644 --- a/Sources/EmbraceCommonInternal/Swizzling/EmbraceSwizzler.swift +++ b/Sources/EmbraceCommonInternal/Swizzling/EmbraceSwizzler.swift @@ -4,8 +4,9 @@ import ObjectiveC.runtime public class EmbraceSwizzler { - public init() {} - + public init() { + } + /// Swizzles a specific instance method of a given class. /// /// This method allows you to replace the implementation of an instance method in the specified class (`type`) diff --git a/Sources/EmbraceCore/Capture/UX/View/Protocols/CaptureServices+UIViewController.swift b/Sources/EmbraceCore/Capture/UX/View/Protocols/CaptureServices+UIViewController.swift index 0016633c..e6541338 100644 --- a/Sources/EmbraceCore/Capture/UX/View/Protocols/CaptureServices+UIViewController.swift +++ b/Sources/EmbraceCore/Capture/UX/View/Protocols/CaptureServices+UIViewController.swift @@ -64,7 +64,7 @@ extension CaptureServices { } guard let builder = viewCaptureService.otel?.buildSpan( - name: name, + name: name, type: type, attributes: attributes, autoTerminationCode: nil diff --git a/Sources/EmbraceCore/Capture/UX/View/UIViewController+Embrace.swift b/Sources/EmbraceCore/Capture/UX/View/UIViewController+Embrace.swift index 404e2d34..09267ac6 100644 --- a/Sources/EmbraceCore/Capture/UX/View/UIViewController+Embrace.swift +++ b/Sources/EmbraceCore/Capture/UX/View/UIViewController+Embrace.swift @@ -14,7 +14,10 @@ extension UIViewController { var emb_instrumentation_state: ViewInstrumentationState? { get { - if let value = objc_getAssociatedObject(self, &AssociatedKeys.anotherIdentifier) as? ViewInstrumentationState { + if let value = objc_getAssociatedObject( + self, + &AssociatedKeys.anotherIdentifier + ) as? ViewInstrumentationState { return value as ViewInstrumentationState } diff --git a/Sources/EmbraceCore/Capture/UX/View/UIViewControllerHandler.swift b/Sources/EmbraceCore/Capture/UX/View/UIViewControllerHandler.swift index 13f1b89f..1a58a410 100644 --- a/Sources/EmbraceCore/Capture/UX/View/UIViewControllerHandler.swift +++ b/Sources/EmbraceCore/Capture/UX/View/UIViewControllerHandler.swift @@ -205,7 +205,6 @@ class UIViewControllerHandler { } } - func onViewDidAppearStart(_ vc: UIViewController, now: Date = Date()) { vc.emb_instrumentation_state?.viewDidAppearSpanCreated = true queue.async { diff --git a/Sources/EmbraceCore/Capture/UX/View/ViewCaptureService+Options.swift b/Sources/EmbraceCore/Capture/UX/View/ViewCaptureService+Options.swift index d407940c..7d55bebb 100644 --- a/Sources/EmbraceCore/Capture/UX/View/ViewCaptureService+Options.swift +++ b/Sources/EmbraceCore/Capture/UX/View/ViewCaptureService+Options.swift @@ -39,9 +39,7 @@ extension ViewCaptureService { /// If the `UIViewController` disappears before the interaction is set as ready, the span status will be set to `error` /// with the `userAbandon` error code. @objc public var instrumentFirstRender: Bool { - get { - instrumentFirstRenderMode.isOn() - } + instrumentFirstRenderMode.isOn() } let instrumentFirstRenderMode: InstrumentFirstRenderMode diff --git a/Sources/EmbraceCore/Capture/UX/View/ViewCaptureService.swift b/Sources/EmbraceCore/Capture/UX/View/ViewCaptureService.swift index 02669a6a..4a28b4d2 100644 --- a/Sources/EmbraceCore/Capture/UX/View/ViewCaptureService.swift +++ b/Sources/EmbraceCore/Capture/UX/View/ViewCaptureService.swift @@ -235,14 +235,18 @@ private extension ViewCaptureService { try swizzler.swizzleDeclaredInstanceMethod( in: UIViewController.self, selector: selector, - implementationType: (@convention(c) (UIViewController, Selector, NSCoder) -> UIViewController?).self, - blockImplementationType: (@convention(block) (UIViewController, NSCoder) -> UIViewController?).self + implementationType: ( + @convention(c) (UIViewController, Selector, NSCoder) -> UIViewController? + ).self, + blockImplementationType: ( + @convention(block) (UIViewController, NSCoder) -> UIViewController? + ).self ) { originalImplementation in { viewController, coder in // Get the class and bundle path of the view controller being initialized and check // if the view controller belongs to the main bundle (this excludes, for eaxmple, UIKit classes) let viewControllerClass = type(of: viewController) - let viewControllerBundlePath = Bundle(for: viewControllerClass).bundlePath; + let viewControllerBundlePath = Bundle(for: viewControllerClass).bundlePath guard viewControllerBundlePath.contains(self.bundlePath) else { return originalImplementation(viewController, selector, coder) } @@ -268,14 +272,18 @@ private extension ViewCaptureService { try swizzler.swizzleDeclaredInstanceMethod( in: UIViewController.self, selector: selector, - implementationType: (@convention(c) (UIViewController, Selector, String?, Bundle?) -> UIViewController).self, - blockImplementationType: (@convention(block) (UIViewController, String?, Bundle?) -> UIViewController).self + implementationType: ( + @convention(c) (UIViewController, Selector, String?, Bundle?) -> UIViewController + ).self, + blockImplementationType: ( + @convention(block) (UIViewController, String?, Bundle?) -> UIViewController + ).self ) { originalImplementation in { viewController, nibName, bundle in // Get the class and bundle path of the view controller being initialized and check // if the view controller belongs to the main bundle (this excludes, for eaxmple, UIKit classes) let viewControllerClass = type(of: viewController) - let viewControllerBundlePath = Bundle(for: viewControllerClass).bundlePath; + let viewControllerBundlePath = Bundle(for: viewControllerClass).bundlePath guard viewControllerBundlePath.contains(self.bundlePath) else { return originalImplementation(viewController, selector, nibName, bundle) } diff --git a/Sources/EmbraceCore/Capture/UX/View/ViewInstrumentationState.swift b/Sources/EmbraceCore/Capture/UX/View/ViewInstrumentationState.swift index 872f0658..ea39bd83 100644 --- a/Sources/EmbraceCore/Capture/UX/View/ViewInstrumentationState.swift +++ b/Sources/EmbraceCore/Capture/UX/View/ViewInstrumentationState.swift @@ -5,7 +5,7 @@ import Foundation class ViewInstrumentationState: NSObject { - var identifier: String? = nil + var identifier: String? var viewDidLoadSpanCreated = false var viewWillAppearSpanCreated = false var viewIsAppearingSpanCreated = false