Resolve malformed macOS version @available directives causing issues on Big Sur (#49)
This commit is contained in:
parent
d831f8a81a
commit
9afddabecc
|
@ -3,7 +3,7 @@ import SwiftUI
|
||||||
import AppKit
|
import AppKit
|
||||||
|
|
||||||
/// Introspection NSView that is inserted alongside the target view.
|
/// Introspection NSView that is inserted alongside the target view.
|
||||||
@available(macOS 15.0, *)
|
@available(macOS 10.15.0, *)
|
||||||
public class IntrospectionNSView: NSView {
|
public class IntrospectionNSView: NSView {
|
||||||
|
|
||||||
required init() {
|
required init() {
|
||||||
|
@ -23,7 +23,7 @@ public class IntrospectionNSView: NSView {
|
||||||
|
|
||||||
/// Introspection View that is injected into the UIKit hierarchy alongside the target view.
|
/// 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.
|
/// 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<TargetViewType: NSView>: NSViewRepresentable {
|
public struct AppKitIntrospectionView<TargetViewType: NSView>: NSViewRepresentable {
|
||||||
|
|
||||||
/// Method that introspects the view hierarchy to find the target view.
|
/// Method that introspects the view hierarchy to find the target view.
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class IntrospectionUIView: UIView {
|
||||||
|
|
||||||
/// Introspection View that is injected into the UIKit hierarchy alongside the target view.
|
/// 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.
|
/// 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<TargetViewType: UIView>: UIViewRepresentable {
|
public struct UIKitIntrospectionView<TargetViewType: UIView>: UIViewRepresentable {
|
||||||
|
|
||||||
/// Method that introspects the view hierarchy to find the target view.
|
/// Method that introspects the view hierarchy to find the target view.
|
||||||
|
|
|
@ -3,7 +3,7 @@ import SwiftUI
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
/// Introspection UIViewController that is inserted alongside the target view controller.
|
/// 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 {
|
public class IntrospectionUIViewController: UIViewController {
|
||||||
required init() {
|
required init() {
|
||||||
super.init(nibName: nil, bundle: nil)
|
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.
|
/// 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<TargetViewControllerType: UIViewController>: UIViewControllerRepresentable {
|
public struct UIKitIntrospectionViewController<TargetViewControllerType: UIViewController>: UIViewControllerRepresentable {
|
||||||
|
|
||||||
let selector: (IntrospectionUIViewController) -> TargetViewControllerType?
|
let selector: (IntrospectionUIViewController) -> TargetViewControllerType?
|
||||||
|
|
|
@ -6,7 +6,7 @@ import AppKit
|
||||||
import UIKit
|
import UIKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
|
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
|
||||||
extension View {
|
extension View {
|
||||||
public func inject<SomeView>(_ view: SomeView) -> some View where SomeView: View {
|
public func inject<SomeView>(_ view: SomeView) -> some View where SomeView: View {
|
||||||
return overlay(view.frame(width: 0, height: 0))
|
return overlay(view.frame(width: 0, height: 0))
|
||||||
|
@ -14,7 +14,7 @@ extension View {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if canImport(UIKit)
|
#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 {
|
extension View {
|
||||||
|
|
||||||
/// Finds a `TargetView` from a `SwiftUI.View`
|
/// Finds a `TargetView` from a `SwiftUI.View`
|
||||||
|
@ -121,7 +121,7 @@ extension View {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
|
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
|
||||||
@available(macOS 15.0, *)
|
@available(macOS 10.15.0, *)
|
||||||
extension View {
|
extension View {
|
||||||
|
|
||||||
/// Finds a `TargetView` from a `SwiftUI.View`
|
/// Finds a `TargetView` from a `SwiftUI.View`
|
||||||
|
|
|
@ -4,7 +4,7 @@ import XCTest
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
@testable import Introspect
|
@testable import Introspect
|
||||||
|
|
||||||
@available(macOS 15.0, *)
|
@available(macOS 10.15.0, *)
|
||||||
enum TestUtils {
|
enum TestUtils {
|
||||||
static func present<ViewType: View>(view: ViewType) {
|
static func present<ViewType: View>(view: ViewType) {
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ enum TestUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 15.0, *)
|
@available(macOS 10.15.0, *)
|
||||||
private struct ListTestView: View {
|
private struct ListTestView: View {
|
||||||
|
|
||||||
let spy1: () -> Void
|
let spy1: () -> Void
|
||||||
|
@ -39,7 +39,7 @@ private struct ListTestView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 15.0, *)
|
@available(macOS 10.15.0, *)
|
||||||
private struct ScrollTestView: View {
|
private struct ScrollTestView: View {
|
||||||
|
|
||||||
let spy1: () -> Void
|
let spy1: () -> Void
|
||||||
|
@ -63,7 +63,7 @@ private struct ScrollTestView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 15.0, *)
|
@available(macOS 10.15.0, *)
|
||||||
private struct TextFieldTestView: View {
|
private struct TextFieldTestView: View {
|
||||||
let spy: () -> Void
|
let spy: () -> Void
|
||||||
@State private var textFieldValue = ""
|
@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 {
|
private struct SliderTestView: View {
|
||||||
let spy: () -> Void
|
let spy: () -> Void
|
||||||
@State private var sliderValue = 0.0
|
@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 {
|
private struct StepperTestView: View {
|
||||||
let spy: () -> Void
|
let spy: () -> Void
|
||||||
var body: some View {
|
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 {
|
private struct DatePickerTestView: View {
|
||||||
let spy: () -> Void
|
let spy: () -> Void
|
||||||
@State private var datePickerValue = Date()
|
@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 {
|
private struct SegmentedControlTestView: View {
|
||||||
@State private var pickerValue = 0
|
@State private var pickerValue = 0
|
||||||
let spy: () -> Void
|
let spy: () -> Void
|
||||||
|
@ -131,7 +131,7 @@ private struct SegmentedControlTestView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 15.0, *)
|
@available(macOS 10.15.0, *)
|
||||||
class AppKitTests: XCTestCase {
|
class AppKitTests: XCTestCase {
|
||||||
|
|
||||||
func testList() {
|
func testList() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import SwiftUI
|
||||||
|
|
||||||
@testable import Introspect
|
@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 {
|
enum TestUtils {
|
||||||
static func present<ViewType: View>(view: ViewType) {
|
static func present<ViewType: View>(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 {
|
private struct NavigationTestView: View {
|
||||||
let spy: () -> Void
|
let spy: () -> Void
|
||||||
var body: some View {
|
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 {
|
private struct ViewControllerTestView: View {
|
||||||
let spy: () -> Void
|
let spy: () -> Void
|
||||||
var body: some View {
|
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 {
|
private struct NavigationRootTestView: View {
|
||||||
let spy: () -> Void
|
let spy: () -> Void
|
||||||
var body: some View {
|
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 {
|
private struct TabTestView: View {
|
||||||
@State private var selection = 0
|
@State private var selection = 0
|
||||||
let spy: () -> Void
|
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 {
|
private struct TabRootTestView: View {
|
||||||
@State private var selection = 0
|
@State private var selection = 0
|
||||||
let spy: () -> Void
|
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 {
|
private struct ListTestView: View {
|
||||||
|
|
||||||
let spy1: () -> Void
|
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 {
|
private struct ScrollTestView: View {
|
||||||
|
|
||||||
let spy1: () -> Void
|
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 {
|
private struct TextFieldTestView: View {
|
||||||
let spy: () -> Void
|
let spy: () -> Void
|
||||||
@State private var textFieldValue = ""
|
@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)
|
@available(tvOS, unavailable)
|
||||||
private struct ToggleTestView: View {
|
private struct ToggleTestView: View {
|
||||||
let spy: () -> Void
|
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)
|
@available(tvOS, unavailable)
|
||||||
private struct SliderTestView: View {
|
private struct SliderTestView: View {
|
||||||
let spy: () -> Void
|
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)
|
@available(tvOS, unavailable)
|
||||||
private struct StepperTestView: View {
|
private struct StepperTestView: View {
|
||||||
let spy: () -> Void
|
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)
|
@available(tvOS, unavailable)
|
||||||
private struct DatePickerTestView: View {
|
private struct DatePickerTestView: View {
|
||||||
let spy: () -> Void
|
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 {
|
private struct SegmentedControlTestView: View {
|
||||||
@State private var pickerValue = 0
|
@State private var pickerValue = 0
|
||||||
let spy: () -> Void
|
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 {
|
class UIKitTests: XCTestCase {
|
||||||
func testNavigation() {
|
func testNavigation() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue