From 6c0bb3dd63fc21d7ad925a9708b407c834f8d220 Mon Sep 17 00:00:00 2001 From: Andrew Clunis Date: Tue, 4 Aug 2020 13:12:59 -0400 Subject: [PATCH] Resolve malformed macOS version @available directives causing issues on Big Sur --- Introspect/AppKitIntrospectionView.swift | 4 +-- Introspect/UIKitIntrospectionView.swift | 2 +- .../UIKitIntrospectionViewController.swift | 4 +-- Introspect/ViewExtensions.swift | 6 ++-- IntrospectTests/AppKitTests.swift | 18 +++++------ IntrospectTests/UIKitTests.swift | 30 +++++++++---------- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Introspect/AppKitIntrospectionView.swift b/Introspect/AppKitIntrospectionView.swift index 02e418ef..d2ace3d2 100644 --- a/Introspect/AppKitIntrospectionView.swift +++ b/Introspect/AppKitIntrospectionView.swift @@ -3,7 +3,7 @@ import SwiftUI import AppKit /// Introspection NSView that is inserted alongside the target view. -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) public class IntrospectionNSView: NSView { required init() { @@ -23,7 +23,7 @@ public class IntrospectionNSView: NSView { /// Introspection View that is injected into the UIKit hierarchy alongside the target view. /// After `updateNSView` is called, it calls `selector` to find the target view, then `customize` when the target view is found. -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) public struct AppKitIntrospectionView: NSViewRepresentable { /// Method that introspects the view hierarchy to find the target view. diff --git a/Introspect/UIKitIntrospectionView.swift b/Introspect/UIKitIntrospectionView.swift index 0a655271..5307afed 100644 --- a/Introspect/UIKitIntrospectionView.swift +++ b/Introspect/UIKitIntrospectionView.swift @@ -20,7 +20,7 @@ public class IntrospectionUIView: UIView { /// Introspection View that is injected into the UIKit hierarchy alongside the target view. /// After `updateUIView` is called, it calls `selector` to find the target view, then `customize` when the target view is found. -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) public struct UIKitIntrospectionView: UIViewRepresentable { /// Method that introspects the view hierarchy to find the target view. diff --git a/Introspect/UIKitIntrospectionViewController.swift b/Introspect/UIKitIntrospectionViewController.swift index 8eadf178..e7343a33 100644 --- a/Introspect/UIKitIntrospectionViewController.swift +++ b/Introspect/UIKitIntrospectionViewController.swift @@ -3,7 +3,7 @@ import SwiftUI import UIKit /// Introspection UIViewController that is inserted alongside the target view controller. -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) public class IntrospectionUIViewController: UIViewController { required init() { super.init(nibName: nil, bundle: nil) @@ -17,7 +17,7 @@ public class IntrospectionUIViewController: UIViewController { } /// This is the same logic as IntrospectionView but for view controllers. Please see details above. -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) public struct UIKitIntrospectionViewController: UIViewControllerRepresentable { let selector: (IntrospectionUIViewController) -> TargetViewControllerType? diff --git a/Introspect/ViewExtensions.swift b/Introspect/ViewExtensions.swift index 374e6b7d..1814c4e2 100644 --- a/Introspect/ViewExtensions.swift +++ b/Introspect/ViewExtensions.swift @@ -6,7 +6,7 @@ import AppKit import UIKit #endif -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) extension View { public func inject(_ view: SomeView) -> some View where SomeView: View { return overlay(view.frame(width: 0, height: 0)) @@ -14,7 +14,7 @@ extension View { } #if canImport(UIKit) -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) extension View { /// Finds a `TargetView` from a `SwiftUI.View` @@ -117,7 +117,7 @@ extension View { #endif #if canImport(AppKit) && !targetEnvironment(macCatalyst) -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) extension View { /// Finds a `TargetView` from a `SwiftUI.View` diff --git a/IntrospectTests/AppKitTests.swift b/IntrospectTests/AppKitTests.swift index f0917523..591ea8b5 100644 --- a/IntrospectTests/AppKitTests.swift +++ b/IntrospectTests/AppKitTests.swift @@ -4,7 +4,7 @@ import XCTest import SwiftUI @testable import Introspect -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) enum TestUtils { static func present(view: ViewType) { @@ -19,7 +19,7 @@ enum TestUtils { } } -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) private struct ListTestView: View { let spy1: () -> Void @@ -39,7 +39,7 @@ private struct ListTestView: View { } } -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) private struct ScrollTestView: View { let spy1: () -> Void @@ -63,7 +63,7 @@ private struct ScrollTestView: View { } } -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) private struct TextFieldTestView: View { let spy: () -> Void @State private var textFieldValue = "" @@ -75,7 +75,7 @@ private struct TextFieldTestView: View { } } -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) private struct SliderTestView: View { let spy: () -> Void @State private var sliderValue = 0.0 @@ -87,7 +87,7 @@ private struct SliderTestView: View { } } -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) private struct StepperTestView: View { let spy: () -> Void var body: some View { @@ -100,7 +100,7 @@ private struct StepperTestView: View { } } -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) private struct DatePickerTestView: View { let spy: () -> Void @State private var datePickerValue = Date() @@ -114,7 +114,7 @@ private struct DatePickerTestView: View { } } -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) private struct SegmentedControlTestView: View { @State private var pickerValue = 0 let spy: () -> Void @@ -131,7 +131,7 @@ private struct SegmentedControlTestView: View { } } -@available(macOS 15.0, *) +@available(macOS 10.15.0, *) class AppKitTests: XCTestCase { func testList() { diff --git a/IntrospectTests/UIKitTests.swift b/IntrospectTests/UIKitTests.swift index 625db989..c2c88723 100644 --- a/IntrospectTests/UIKitTests.swift +++ b/IntrospectTests/UIKitTests.swift @@ -4,7 +4,7 @@ import SwiftUI @testable import Introspect -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) enum TestUtils { static func present(view: ViewType) { @@ -28,7 +28,7 @@ enum TestUtils { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) private struct NavigationTestView: View { let spy: () -> Void var body: some View { @@ -43,7 +43,7 @@ private struct NavigationTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) private struct ViewControllerTestView: View { let spy: () -> Void var body: some View { @@ -58,7 +58,7 @@ private struct ViewControllerTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) private struct NavigationRootTestView: View { let spy: () -> Void var body: some View { @@ -73,7 +73,7 @@ private struct NavigationRootTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) private struct TabTestView: View { @State private var selection = 0 let spy: () -> Void @@ -88,7 +88,7 @@ private struct TabTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) private struct TabRootTestView: View { @State private var selection = 0 let spy: () -> Void @@ -103,7 +103,7 @@ private struct TabRootTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) private struct ListTestView: View { let spy1: () -> Void @@ -123,7 +123,7 @@ private struct ListTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) private struct ScrollTestView: View { let spy1: () -> Void @@ -147,7 +147,7 @@ private struct ScrollTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) private struct TextFieldTestView: View { let spy: () -> Void @State private var textFieldValue = "" @@ -159,7 +159,7 @@ private struct TextFieldTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) @available(tvOS, unavailable) private struct ToggleTestView: View { let spy: () -> Void @@ -172,7 +172,7 @@ private struct ToggleTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) @available(tvOS, unavailable) private struct SliderTestView: View { let spy: () -> Void @@ -185,7 +185,7 @@ private struct SliderTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) @available(tvOS, unavailable) private struct StepperTestView: View { let spy: () -> Void @@ -199,7 +199,7 @@ private struct StepperTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) @available(tvOS, unavailable) private struct DatePickerTestView: View { let spy: () -> Void @@ -214,7 +214,7 @@ private struct DatePickerTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) private struct SegmentedControlTestView: View { @State private var pickerValue = 0 let spy: () -> Void @@ -231,7 +231,7 @@ private struct SegmentedControlTestView: View { } } -@available(iOS 13.0, tvOS 13.0, macOS 15.0, *) +@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *) class UIKitTests: XCTestCase { func testNavigation() {