Skip to content

Commit d32609e

Browse files
committed
WIP
1 parent 9a6d6d3 commit d32609e

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed

Sources/ViewTypes/TabView.swift

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@
4949
/// }
5050
/// ```
5151
///
52+
/// ### macOS 15+ (non-root placement only)
53+
///
54+
/// ```swift
55+
/// struct ContentView: View {
56+
/// var body: some View {
57+
/// GroupBox {
58+
/// TabView {
59+
/// Text("Tab 1").tabItem { Text("Tab 1") }
60+
/// Text("Tab 2").tabItem { Text("Tab 2") }
61+
/// }
62+
/// .introspect(.tabView, on: .macOS(.v15, .v26)) {
63+
/// print(type(of: $0)) // NSTabView
64+
/// }
65+
/// }
66+
/// }
67+
/// }
68+
/// ```
69+
///
5270
/// ### visionOS
5371
///
5472
/// Not available.
@@ -100,10 +118,8 @@ extension macOSViewVersion<TabViewType, NSTabView> {
100118
public static let v12 = Self(for: .v12)
101119
public static let v13 = Self(for: .v13)
102120
public static let v14 = Self(for: .v14)
103-
@available(*, unavailable, message: "TabView is no longer backed by NSTabView starting macOS 15")
104-
public static let v15 = Self.unavailable()
105-
@available(*, unavailable, message: "TabView is no longer backed by NSTabView starting macOS 15")
106-
public static let v26 = Self.unavailable()
121+
public static let v15 = Self(for: .v15)
122+
public static let v26 = Self(for: .v26)
107123
}
108124
#endif
109125
#endif

Tests/Tests/ViewTypes/TabViewTests.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,41 @@ struct TabViewTests {
4545
}
4646
}
4747
}
48+
49+
@Test func introspectWithNonRootPlacement() async throws {
50+
try await introspection(of: PlatformTabView.self) { spy in
51+
GroupBox {
52+
TabView {
53+
ZStack {
54+
Color.red
55+
Text("Something")
56+
}
57+
}
58+
#if os(iOS) || os(tvOS)
59+
.introspect(.tabView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), customize: spy)
60+
#elseif os(macOS)
61+
.introspect(.tabView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy)
62+
#endif
63+
}
64+
}
65+
}
66+
67+
@Test func introspectWithNonRootPlacementAsAncestor() async throws {
68+
try await introspection(of: PlatformTabView.self) { spy in
69+
GroupBox {
70+
TabView {
71+
ZStack {
72+
Color.red
73+
Text("Something")
74+
#if os(iOS) || os(tvOS)
75+
.introspect(.tabView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor, customize: spy)
76+
#elseif os(macOS)
77+
.introspect(.tabView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor, customize: spy)
78+
#endif
79+
}
80+
}
81+
}
82+
}
83+
}
4884
}
4985
#endif

0 commit comments

Comments
 (0)