diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..cc4a6d555 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +# editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true +insert_final_newline = true +end_of_line = lf diff --git a/Sources/ViewTypes/TabView.swift b/Sources/ViewTypes/TabView.swift index 6e739599e..80abe390d 100644 --- a/Sources/ViewTypes/TabView.swift +++ b/Sources/ViewTypes/TabView.swift @@ -49,6 +49,24 @@ /// } /// ``` /// +/// ### macOS 15+ (non-root placement only) +/// +/// ```swift +/// struct ContentView: View { +/// var body: some View { +/// GroupBox { +/// TabView { +/// Text("Tab 1").tabItem { Text("Tab 1") } +/// Text("Tab 2").tabItem { Text("Tab 2") } +/// } +/// .introspect(.tabView, on: .macOS(.v15, .v26)) { +/// print(type(of: $0)) // NSTabView +/// } +/// } +/// } +/// } +/// ``` +/// /// ### visionOS /// /// Not available. @@ -100,10 +118,8 @@ extension macOSViewVersion { public static let v12 = Self(for: .v12) public static let v13 = Self(for: .v13) public static let v14 = Self(for: .v14) - @available(*, unavailable, message: "TabView is no longer backed by NSTabView starting macOS 15") - public static let v15 = Self.unavailable() - @available(*, unavailable, message: "TabView is no longer backed by NSTabView starting macOS 15") - public static let v26 = Self.unavailable() + public static let v15 = Self(for: .v15) + public static let v26 = Self(for: .v26) } #endif #endif diff --git a/Tests/Tests/ViewTypes/TabViewTests.swift b/Tests/Tests/ViewTypes/TabViewTests.swift index 0b520eb23..46c330af5 100644 --- a/Tests/Tests/ViewTypes/TabViewTests.swift +++ b/Tests/Tests/ViewTypes/TabViewTests.swift @@ -45,5 +45,43 @@ struct TabViewTests { } } } + + @available(tvOS, unavailable) + @Test func introspectWithNonRootPlacement() async throws { + try await introspection(of: PlatformTabView.self) { spy in + GroupBox { + TabView { + ZStack { + Color.red + Text("Something") + } + } + #if os(iOS) || os(tvOS) + .introspect(.tabView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy) + #elseif os(macOS) + .introspect(.tabView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy) + #endif + } + } + } + + @available(tvOS, unavailable) + @Test func introspectWithNonRootPlacementAsAncestor() async throws { + try await introspection(of: PlatformTabView.self) { spy in + GroupBox { + TabView { + ZStack { + Color.red + Text("Something") + #if os(iOS) || os(tvOS) + .introspect(.tabView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor, customize: spy) + #elseif os(macOS) + .introspect(.tabView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy) + #endif + } + } + } + } + } } #endif