From 06d975c225055b70d55ae4ad5ef552c4e79422c4 Mon Sep 17 00:00:00 2001 From: Kevin Renskers Date: Tue, 13 Sep 2022 10:47:00 +0200 Subject: [PATCH] Fix compile errors in Xcode 14 New version of SwiftFormat doing its thing --- .../iOS-Swift/iOS-Swift/Tools/SpanObserver.swift | 4 ++-- .../tvOS-Swift/tvOS-SBSwift/ViewController.swift | 2 +- .../Helper/UrlSessionDelegateSpy.swift | 2 +- .../SentryFramesTrackerTests.swift | 2 +- .../SentryFileIOTrackingIntegrationTests.swift | 2 +- .../SentryUIViewControllerSwizzlingTests.swift | 16 +++++++++++----- .../Networking/TestRequestManager.swift | 2 +- .../TestSentryDispatchQueueWrapper.swift | 2 +- Tests/SentryTests/SentryScreenShotTests.swift | 2 +- .../Transaction/SentrySpanTests.swift | 2 +- 10 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift/Tools/SpanObserver.swift b/Samples/iOS-Swift/iOS-Swift/Tools/SpanObserver.swift index 9fa6b758c1b..89d1d8e775d 100644 --- a/Samples/iOS-Swift/iOS-Swift/Tools/SpanObserver.swift +++ b/Samples/iOS-Swift/iOS-Swift/Tools/SpanObserver.swift @@ -22,7 +22,7 @@ class SpanObserver: NSObject { } } - func performOnFinish(callback : @escaping (Span) -> Void) { + func performOnFinish(callback: @escaping (Span) -> Void) { addSpanObserver(forKeyPath: "timestamp", callback: callback) } @@ -32,7 +32,7 @@ class SpanObserver: NSObject { } } - func addSpanObserver(forKeyPath keyPath: String, callback : @escaping (Span) -> Void) { + func addSpanObserver(forKeyPath keyPath: String, callback: @escaping (Span) -> Void) { callbacks[keyPath] = callback //The given span may be a SentryTracer that wont respond to KVO. We need to get the root Span let spanToObserve = span.rootSpan() ?? span diff --git a/Samples/tvOS-Swift/tvOS-SBSwift/ViewController.swift b/Samples/tvOS-Swift/tvOS-SBSwift/ViewController.swift index 113c9157312..2f15984e2f7 100644 --- a/Samples/tvOS-Swift/tvOS-SBSwift/ViewController.swift +++ b/Samples/tvOS-Swift/tvOS-SBSwift/ViewController.swift @@ -5,7 +5,7 @@ class ViewController: UICollectionViewController { struct Action { var title: String - var callback : () -> Void + var callback: () -> Void } var actions: [Action]! diff --git a/Tests/SentryTests/Helper/UrlSessionDelegateSpy.swift b/Tests/SentryTests/Helper/UrlSessionDelegateSpy.swift index 67ab6a2a654..dc71b34cfc3 100644 --- a/Tests/SentryTests/Helper/UrlSessionDelegateSpy.swift +++ b/Tests/SentryTests/Helper/UrlSessionDelegateSpy.swift @@ -1,7 +1,7 @@ import Foundation class UrlSessionDelegateSpy: NSObject, URLSessionDelegate { - var delegateCallback : () -> Void = {} + var delegateCallback: () -> Void = {} func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { delegateCallback() diff --git a/Tests/SentryTests/Integrations/Performance/FramesTracking/SentryFramesTrackerTests.swift b/Tests/SentryTests/Integrations/Performance/FramesTracking/SentryFramesTrackerTests.swift index 88978d52c78..0557fe43471 100644 --- a/Tests/SentryTests/Integrations/Performance/FramesTracking/SentryFramesTrackerTests.swift +++ b/Tests/SentryTests/Integrations/Performance/FramesTracking/SentryFramesTrackerTests.swift @@ -113,7 +113,7 @@ class SentryFramesTrackerTests: XCTestCase { XCTAssertEqual(0, sut.currentFrames.frozen) } - private func assertPreviousCountBiggerThanCurrent(_ group: DispatchGroup, count: @escaping () -> UInt) { + private func assertPreviousCountBiggerThanCurrent(_ group: DispatchGroup, count: @escaping () -> UInt) { group.enter() fixture.queue.async { var previousCount: UInt = 0 diff --git a/Tests/SentryTests/Integrations/Performance/IO/SentryFileIOTrackingIntegrationTests.swift b/Tests/SentryTests/Integrations/Performance/IO/SentryFileIOTrackingIntegrationTests.swift index b2669d98221..ca59fa5f8e3 100644 --- a/Tests/SentryTests/Integrations/Performance/IO/SentryFileIOTrackingIntegrationTests.swift +++ b/Tests/SentryTests/Integrations/Performance/IO/SentryFileIOTrackingIntegrationTests.swift @@ -224,7 +224,7 @@ class SentryFileIOTrackingIntegrationTests: XCTestCase { } } - private func assertSpans( _ spansCount: Int, _ operation: String, _ description: String = "TestFile", _ block : () -> Void) { + private func assertSpans( _ spansCount: Int, _ operation: String, _ description: String = "TestFile", _ block: () -> Void) { let parentTransaction = SentrySDK.startTransaction(name: "Transaction", operation: "Test", bindToScope: true) block() diff --git a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift index 07bf578b5bc..de2b66349e7 100644 --- a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift +++ b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift @@ -159,15 +159,21 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { } func testSwizzle_fromApplication_noWindowMethod() { - XCTAssertFalse(fixture.sut.swizzleRootViewController(from: MockApplication(MockApplication.MockApplicationDelegateNoWindow()))) + let mockApplicationDelegate = MockApplication.MockApplicationDelegateNoWindow() + let mockApplication = MockApplication(mockApplicationDelegate) + XCTAssertFalse(fixture.sut.swizzleRootViewController(from: mockApplication)) } - + func testSwizzle_fromApplication_noWindow() { - XCTAssertFalse(fixture.sut.swizzleRootViewController(from: MockApplication(MockApplication.MockApplicationDelegate(nil)))) + let mockApplicationDelegate = MockApplication.MockApplicationDelegate(nil) + let mockApplication = MockApplication(mockApplicationDelegate) + XCTAssertFalse(fixture.sut.swizzleRootViewController(from: mockApplication)) } - + func testSwizzle_fromApplication_noRootViewController_InWindow() { - XCTAssertFalse(fixture.sut.swizzleRootViewController(from: MockApplication(MockApplication.MockApplicationDelegate(UIWindow())))) + let mockApplicationDelegate = MockApplication.MockApplicationDelegate(UIWindow()) + let mockApplication = MockApplication(mockApplicationDelegate) + XCTAssertFalse(fixture.sut.swizzleRootViewController(from: mockApplication)) } func testSwizzle_fromApplication() { diff --git a/Tests/SentryTests/Networking/TestRequestManager.swift b/Tests/SentryTests/Networking/TestRequestManager.swift index 16e9afe3509..7962ee89ee3 100644 --- a/Tests/SentryTests/Networking/TestRequestManager.swift +++ b/Tests/SentryTests/Networking/TestRequestManager.swift @@ -5,7 +5,7 @@ import Foundation @available(OSX 10.12, *) public class TestRequestManager: NSObject, RequestManager { - private var nextResponse : () -> HTTPURLResponse? = { return nil } + private var nextResponse: () -> HTTPURLResponse? = { return nil } var nextError: NSError? public var isReady: Bool diff --git a/Tests/SentryTests/Networking/TestSentryDispatchQueueWrapper.swift b/Tests/SentryTests/Networking/TestSentryDispatchQueueWrapper.swift index e1b0c0876ff..b7d9ddff0b1 100644 --- a/Tests/SentryTests/Networking/TestSentryDispatchQueueWrapper.swift +++ b/Tests/SentryTests/Networking/TestSentryDispatchQueueWrapper.swift @@ -10,7 +10,7 @@ class TestSentryDispatchQueueWrapper: SentryDispatchQueueWrapper { } var blockOnMainInvocations = Invocations<() -> Void>() - var blockBeforeMainBlock : () -> Bool = { true } + var blockBeforeMainBlock: () -> Bool = { true } override func dispatch(onMainQueue block: @escaping () -> Void) { blockOnMainInvocations.record(block) diff --git a/Tests/SentryTests/SentryScreenShotTests.swift b/Tests/SentryTests/SentryScreenShotTests.swift index 55a28697848..e8dc6725486 100644 --- a/Tests/SentryTests/SentryScreenShotTests.swift +++ b/Tests/SentryTests/SentryScreenShotTests.swift @@ -97,7 +97,7 @@ class SentryScreenShotTests: XCTestCase { } class TestWindow: UIWindow { - var onDrawHierarchy : (() -> Void)? + var onDrawHierarchy: (() -> Void)? override func drawHierarchy(in rect: CGRect, afterScreenUpdates afterUpdates: Bool) -> Bool { onDrawHierarchy?() diff --git a/Tests/SentryTests/Transaction/SentrySpanTests.swift b/Tests/SentryTests/Transaction/SentrySpanTests.swift index 168aaa8d175..6e86d33dd74 100644 --- a/Tests/SentryTests/Transaction/SentrySpanTests.swift +++ b/Tests/SentryTests/Transaction/SentrySpanTests.swift @@ -284,7 +284,7 @@ class SentrySpanTests: XCTestCase { func testSpanWithoutTracer_StartChild_ReturnsNoOpSpan() { // Span has a weak reference to tracer. If we don't keep a reference // to the tracer ARC will deallocate the tracer. - let sutGenerator : () -> Span = { + let sutGenerator: () -> Span = { let tracer = SentryTracer() return SentrySpan(tracer: tracer, context: SpanContext(operation: "")) }