Skip to content

Commit ad6feff

Browse files
committed
WIP
1 parent 7ead5f0 commit ad6feff

File tree

3 files changed

+64
-58
lines changed

3 files changed

+64
-58
lines changed

Examples/Showcase/Showcase.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
D5B864E82E72BF0F002F5243 /* ScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864E72E72BF0F002F5243 /* ScrollView.swift */; };
1414
D5B864EA2E72CE71002F5243 /* List.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864E92E72CE71002F5243 /* List.swift */; };
1515
D5B864EC2E72D9E1002F5243 /* Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864EB2E72D9E1002F5243 /* Navigation.swift */; };
16+
D5B864EE2E72DB42002F5243 /* Presentation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864ED2E72DB42002F5243 /* Presentation.swift */; };
1617
D5E3180329C132B6005847DC /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = D5E3180229C132B6005847DC /* SwiftUIIntrospect */; };
1718
/* End PBXBuildFile section */
1819

@@ -25,6 +26,7 @@
2526
D5B864E72E72BF0F002F5243 /* ScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollView.swift; sourceTree = "<group>"; };
2627
D5B864E92E72CE71002F5243 /* List.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = List.swift; sourceTree = "<group>"; };
2728
D5B864EB2E72D9E1002F5243 /* Navigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Navigation.swift; sourceTree = "<group>"; };
29+
D5B864ED2E72DB42002F5243 /* Presentation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Presentation.swift; sourceTree = "<group>"; };
2830
/* End PBXFileReference section */
2931

3032
/* Begin PBXFrameworksBuildPhase section */
@@ -65,6 +67,7 @@
6567
D5B864E92E72CE71002F5243 /* List.swift */,
6668
D5B864E72E72BF0F002F5243 /* ScrollView.swift */,
6769
D5B864EB2E72D9E1002F5243 /* Navigation.swift */,
70+
D5B864ED2E72DB42002F5243 /* Presentation.swift */,
6871
D5B829742999738200920EBD /* Helpers.swift */,
6972
);
7073
path = Showcase;
@@ -149,6 +152,7 @@
149152
buildActionMask = 2147483647;
150153
files = (
151154
D53071F929983CEF00F1936C /* AppView.swift in Sources */,
155+
D5B864EE2E72DB42002F5243 /* Presentation.swift in Sources */,
152156
D5B864E82E72BF0F002F5243 /* ScrollView.swift in Sources */,
153157
D5B829752999738200920EBD /* Helpers.swift in Sources */,
154158
D5B864EC2E72D9E1002F5243 /* Navigation.swift in Sources */,

Examples/Showcase/Showcase/AppView.swift

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -58,64 +58,6 @@ struct ContentView: View {
5858
}
5959
}
6060

61-
#if !os(macOS)
62-
struct PresentationShowcase: View {
63-
@State var isSheetPresented = false
64-
@State var isFullScreenPresented = false
65-
@State var isPopoverPresented = false
66-
67-
var body: some View {
68-
VStack(spacing: 20) {
69-
Button("Sheet", action: { isSheetPresented = true })
70-
.sheet(isPresented: $isSheetPresented) {
71-
Button("Dismiss", action: { isSheetPresented = false })
72-
#if os(iOS) || os(tvOS)
73-
.introspect(
74-
.sheet,
75-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)
76-
) { presentationController in
77-
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
78-
}
79-
#elseif os(visionOS)
80-
.introspect(.sheet, on: .visionOS(.v1, .v2, .v26)) { sheetPresentationController in
81-
sheetPresentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
82-
}
83-
#endif
84-
}
85-
86-
if #available(iOS 14, tvOS 14, *) {
87-
Button("Full Screen Cover", action: { isFullScreenPresented = true })
88-
.fullScreenCover(isPresented: $isFullScreenPresented) {
89-
Button("Dismiss", action: { isFullScreenPresented = false })
90-
#if os(iOS) || os(tvOS) || os(visionOS)
91-
.introspect(
92-
.fullScreenCover,
93-
on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
94-
) { presentationController in
95-
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
96-
}
97-
#endif
98-
}
99-
}
100-
101-
#if os(iOS) || os(visionOS)
102-
Button("Popover", action: { isPopoverPresented = true })
103-
.popover(isPresented: $isPopoverPresented) {
104-
Button("Dismiss", action: { isPopoverPresented = false })
105-
.padding()
106-
.introspect(
107-
.popover,
108-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
109-
) { presentationController in
110-
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
111-
}
112-
}
113-
#endif
114-
}
115-
}
116-
}
117-
#endif
118-
11961
struct UIViewRepresentableShowcase: View {
12062
var body: some View {
12163
VStack(spacing: 10) {
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import SwiftUI
2+
import SwiftUIIntrospect
3+
4+
#if !os(macOS)
5+
struct PresentationShowcase: View {
6+
@State var isSheetPresented = false
7+
@State var isFullScreenPresented = false
8+
@State var isPopoverPresented = false
9+
10+
var body: some View {
11+
VStack(spacing: 20) {
12+
Button("Sheet", action: { isSheetPresented = true })
13+
.sheet(isPresented: $isSheetPresented) {
14+
Button("Dismiss", action: { isSheetPresented = false })
15+
#if os(iOS) || os(tvOS)
16+
.introspect(
17+
.sheet,
18+
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)
19+
) { presentationController in
20+
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
21+
}
22+
#elseif os(visionOS)
23+
.introspect(.sheet, on: .visionOS(.v1, .v2, .v26)) { sheetPresentationController in
24+
sheetPresentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
25+
}
26+
#endif
27+
}
28+
29+
if #available(iOS 14, tvOS 14, *) {
30+
Button("Full Screen Cover", action: { isFullScreenPresented = true })
31+
.fullScreenCover(isPresented: $isFullScreenPresented) {
32+
Button("Dismiss", action: { isFullScreenPresented = false })
33+
#if os(iOS) || os(tvOS) || os(visionOS)
34+
.introspect(
35+
.fullScreenCover,
36+
on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
37+
) { presentationController in
38+
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
39+
}
40+
#endif
41+
}
42+
}
43+
44+
#if os(iOS) || os(visionOS)
45+
Button("Popover", action: { isPopoverPresented = true })
46+
.popover(isPresented: $isPopoverPresented) {
47+
Button("Dismiss", action: { isPopoverPresented = false })
48+
.padding()
49+
.introspect(
50+
.popover,
51+
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
52+
) { presentationController in
53+
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
54+
}
55+
}
56+
#endif
57+
}
58+
}
59+
}
60+
#endif

0 commit comments

Comments
 (0)