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
6 changes: 6 additions & 0 deletions Examples/Showcase/Showcase/AppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,24 @@ struct ContentView: View {
TabView(selection: $selection) {
ListShowcase()
.tabItem { Label("List", systemImage: "1.circle") }
.tag(0)
ScrollViewShowcase()
.tabItem { Label("ScrollView", systemImage: "2.circle") }
.tag(1)
#if !os(macOS)
NavigationShowcase()
.tabItem { Label("Navigation", systemImage: "3.circle") }
.tag(2)
PresentationShowcase()
.tabItem { Label("Presentation", systemImage: "4.circle") }
.tag(3)
#endif
ControlsShowcase()
.tabItem { Label("Controls", systemImage: "5.circle") }
.tag(4)
UIViewRepresentableShowcase()
.tabItem { Label("UIViewRepresentable", systemImage: "6.circle") }
.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
Expand Down
30 changes: 17 additions & 13 deletions Examples/Showcase/Showcase/UIViewRepresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ import SwiftUI
@_spi(Internals) import SwiftUIIntrospect

struct UIViewRepresentableShowcase: View {
let colors: [Color] = [.red, .green, .blue]

var body: some View {
VStack(spacing: 10) {
GenericViewRepresentable()
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.view,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { view in
view.backgroundColor = .cyan
}
#elseif os(macOS)
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { view in
view.layer?.backgroundColor = NSColor.cyan.cgColor
}
#endif
ForEach(colors, id: \.self) { color in
GenericViewRepresentable()
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.view,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
) { view in
view.backgroundColor = UIColor(color)
}
#elseif os(macOS)
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { view in
view.layer?.backgroundColor = NSColor(color).cgColor
}
#endif
}
}
.padding()
#if os(iOS) || os(tvOS) || os(visionOS)
Expand Down
Loading