Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
24 changes: 20 additions & 4 deletions Sources/ViewTypes/TabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -100,10 +118,8 @@ extension macOSViewVersion<TabViewType, NSTabView> {
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
Expand Down
38 changes: 38 additions & 0 deletions Tests/Tests/ViewTypes/TabViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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