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
8 changes: 4 additions & 4 deletions Examples/Showcase/Showcase/AppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ struct AppView: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.window,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { window in
window.backgroundColor = .brown
}
#elseif os(macOS)
.introspect(.window, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { window in
.introspect(.window, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { window in
window.backgroundColor = .lightGray
}
#endif
Expand Down Expand Up @@ -46,7 +46,7 @@ struct ContentView: View {
.tag(5)
}
#if os(iOS) || os(tvOS)
.introspect(.tabView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { tabBarController in
.introspect(.tabView, on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26)) { tabBarController in
if #available(iOS 26, macOS 26, tvOS 26, *) {
tabBarController.tabBar.backgroundColor = .green
} else {
Expand All @@ -58,7 +58,7 @@ struct ContentView: View {
}
}
#elseif os(macOS)
.introspect(.tabView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { splitView in
.introspect(.tabView, on: .macOS(.v12, .v13, .v14)) { splitView in
splitView.subviews.first?.layer?.backgroundColor = NSColor.green.cgColor
}
#endif
Expand Down
40 changes: 20 additions & 20 deletions Examples/Showcase/Showcase/Controls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ struct ControlsShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.textField,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { textField in
textField.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { textField in
.introspect(.textField, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { textField in
textField.backgroundColor = .red
}
#endif
Expand All @@ -31,12 +31,12 @@ struct ControlsShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.textField,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { textField in
textField.backgroundColor = .green
}
#elseif os(macOS)
.introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { textField in
.introspect(.textField, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { textField in
textField.backgroundColor = .green
}
#endif
Expand All @@ -49,12 +49,12 @@ struct ControlsShowcase: View {
#if os(iOS)
.introspect(
.toggle,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26)
) { toggle in
toggle.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { toggle in
.introspect(.toggle, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { toggle in
toggle.layer?.backgroundColor = NSColor.red.cgColor
}
#endif
Expand All @@ -63,12 +63,12 @@ struct ControlsShowcase: View {
#if os(iOS)
.introspect(
.toggle,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26)
) { toggle in
toggle.backgroundColor = .green
}
#elseif os(macOS)
.introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { toggle in
.introspect(.toggle, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { toggle in
toggle.layer?.backgroundColor = NSColor.green.cgColor
}
#endif
Expand All @@ -77,22 +77,22 @@ struct ControlsShowcase: View {
HStack {
Slider(value: $sliderValue, in: 0...100)
#if os(iOS)
.introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { slider in
.introspect(.slider, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { slider in
slider.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { slider in
.introspect(.slider, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { slider in
slider.layer?.backgroundColor = NSColor.red.cgColor
}
#endif

Slider(value: $sliderValue, in: 0...100)
#if os(iOS)
.introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { slider in
.introspect(.slider, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { slider in
slider.backgroundColor = .green
}
#elseif os(macOS)
.introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { slider in
.introspect(.slider, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { slider in
slider.layer?.backgroundColor = NSColor.green.cgColor
}
#endif
Expand All @@ -103,11 +103,11 @@ struct ControlsShowcase: View {
Text("Stepper Red")
}
#if os(iOS)
.introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { stepper in
.introspect(.stepper, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { stepper in
stepper.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { stepper in
.introspect(.stepper, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { stepper in
stepper.layer?.backgroundColor = NSColor.red.cgColor
}
#endif
Expand All @@ -116,11 +116,11 @@ struct ControlsShowcase: View {
Text("Stepper Green")
}
#if os(iOS)
.introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { stepper in
.introspect(.stepper, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { stepper in
stepper.backgroundColor = .green
}
#elseif os(macOS)
.introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { stepper in
.introspect(.stepper, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { stepper in
stepper.layer?.backgroundColor = NSColor.green.cgColor
}
#endif
Expand All @@ -132,11 +132,11 @@ struct ControlsShowcase: View {
Text("DatePicker Red")
}
#if os(iOS) || os(visionOS)
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { datePicker in
.introspect(.datePicker, on: .iOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { datePicker in
datePicker.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { datePicker in
.introspect(.datePicker, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { datePicker in
datePicker.layer?.backgroundColor = NSColor.red.cgColor
}
#endif
Expand All @@ -153,12 +153,12 @@ struct ControlsShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.picker(style: .segmented),
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { datePicker in
datePicker.backgroundColor = .red
}
#elseif os(macOS)
.introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { datePicker in
.introspect(.picker(style: .segmented), on: .macOS(.v12, .v13, .v14, .v15, .v26)) { datePicker in
datePicker.layer?.backgroundColor = NSColor.red.cgColor
}
#endif
Expand Down
8 changes: 4 additions & 4 deletions Examples/Showcase/Showcase/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct ListShowcase: View {
}
}
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { tableView in
.introspect(.list, on: .iOS(.v15), .tvOS(.v15, .v16, .v17, .v18, .v26)) { tableView in
tableView.backgroundView = UIView()
tableView.backgroundColor = .cyan
}
Expand All @@ -53,7 +53,7 @@ struct ListShowcase: View {
}
}
#elseif os(macOS)
.introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { tableView in
.introspect(.list, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { tableView in
DispatchQueue.main.async {
receiverListFound = true
}
Expand All @@ -71,7 +71,7 @@ struct ListShowcase: View {
Text("Item 1")
Text("Item 2")
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor) { tableView in
.introspect(.list, on: .iOS(.v15), .tvOS(.v15, .v16, .v17, .v18, .v26), scope: .ancestor) { tableView in
tableView.backgroundView = UIView()
tableView.backgroundColor = .cyan
}
Expand All @@ -81,7 +81,7 @@ struct ListShowcase: View {
}
}
#elseif os(macOS)
.introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor) { tableView in
.introspect(.list, on: .macOS(.v12, .v13, .v14, .v15, .v26), scope: .ancestor) { tableView in
DispatchQueue.main.async {
ancestorListFound = true
}
Expand Down
14 changes: 4 additions & 10 deletions Examples/Showcase/Showcase/Navigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ struct NavigationShowcase: View {
var body: some View {
NavigationView {
Text("Content")
.modifier {
if #available(iOS 15, tvOS 15, macOS 12, *) {
$0.searchable(text: .constant(""))
} else {
$0
}
}
.searchable(text: .constant(""))
#if os(iOS) || os(visionOS)
.navigationBarTitle(Text("Customized"), displayMode: .inline)
#elseif os(macOS)
Expand All @@ -21,21 +15,21 @@ struct NavigationShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.navigationView(style: .stack),
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { navigationController in
navigationController.navigationBar.backgroundColor = .cyan
}
.introspect(
.navigationView(style: .columns),
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { splitViewController in
#if os(visionOS)
splitViewController.preferredDisplayMode = .oneBesideSecondary
#else
splitViewController.preferredDisplayMode = .oneOverSecondary
#endif
}
.introspect(.navigationView(style: .columns), on: .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { navigationController in
.introspect(.navigationView(style: .columns), on: .tvOS(.v15, .v16, .v17, .v18, .v26)) { navigationController in
navigationController.navigationBar.backgroundColor = .cyan
}
.introspect(
Expand Down
30 changes: 14 additions & 16 deletions Examples/Showcase/Showcase/Presentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct PresentationShowcase: View {
#if os(iOS) || os(tvOS)
.introspect(
.sheet,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26)
) { presentationController in
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
Expand All @@ -26,20 +26,18 @@ struct PresentationShowcase: View {
#endif
}

if #available(iOS 14, tvOS 14, *) {
Button("Full Screen Cover", action: { isFullScreenPresented = true })
.fullScreenCover(isPresented: $isFullScreenPresented) {
Button("Dismiss", action: { isFullScreenPresented = false })
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.fullScreenCover,
on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { presentationController in
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
#endif
}
}
Button("Full Screen Cover", action: { isFullScreenPresented = true })
.fullScreenCover(isPresented: $isFullScreenPresented) {
Button("Dismiss", action: { isFullScreenPresented = false })
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.fullScreenCover,
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { presentationController in
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
#endif
}

#if os(iOS) || os(visionOS)
Button("Popover", action: { isPopoverPresented = true })
Expand All @@ -48,7 +46,7 @@ struct PresentationShowcase: View {
.padding()
.introspect(
.popover,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { presentationController in
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
Expand Down
8 changes: 4 additions & 4 deletions Examples/Showcase/Showcase/ScrollView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ struct ScrollViewShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.scrollView,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { _ in
DispatchQueue.main.async {
receiverScrollViewFound = true
}
}
#elseif os(macOS)
.introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { scrollView in
.introspect(.scrollView, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { scrollView in
DispatchQueue.main.async {
receiverScrollViewFound = true
}
Expand All @@ -55,15 +55,15 @@ struct ScrollViewShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.scrollView,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26),
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26),
scope: .ancestor
) { _ in
DispatchQueue.main.async {
ancestorScrollViewFound = true
}
}
#elseif os(macOS)
.introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor) { scrollView in
.introspect(.scrollView, on: .macOS(.v12, .v13, .v14, .v15, .v26), scope: .ancestor) { scrollView in
DispatchQueue.main.async {
ancestorScrollViewFound = true
}
Expand Down
Loading