Skip to content

Commit 53a93cf

Browse files
committed
WIP
1 parent cc61044 commit 53a93cf

File tree

3 files changed

+73
-69
lines changed

3 files changed

+73
-69
lines changed

Examples/Showcase/Showcase.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
D5B864EC2E72D9E1002F5243 /* Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864EB2E72D9E1002F5243 /* Navigation.swift */; };
1616
D5B864EE2E72DB42002F5243 /* Presentation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864ED2E72DB42002F5243 /* Presentation.swift */; };
1717
D5B864F02E72DC75002F5243 /* Controls.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864EF2E72DC75002F5243 /* Controls.swift */; };
18+
D5B864F22E72DCA7002F5243 /* UIViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B864F12E72DCA7002F5243 /* UIViewRepresentable.swift */; };
1819
D5E3180329C132B6005847DC /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = D5E3180229C132B6005847DC /* SwiftUIIntrospect */; };
1920
/* End PBXBuildFile section */
2021

@@ -29,6 +30,7 @@
2930
D5B864EB2E72D9E1002F5243 /* Navigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Navigation.swift; sourceTree = "<group>"; };
3031
D5B864ED2E72DB42002F5243 /* Presentation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Presentation.swift; sourceTree = "<group>"; };
3132
D5B864EF2E72DC75002F5243 /* Controls.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Controls.swift; sourceTree = "<group>"; };
33+
D5B864F12E72DCA7002F5243 /* UIViewRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewRepresentable.swift; sourceTree = "<group>"; };
3234
/* End PBXFileReference section */
3335

3436
/* Begin PBXFrameworksBuildPhase section */
@@ -71,6 +73,7 @@
7173
D5B864EB2E72D9E1002F5243 /* Navigation.swift */,
7274
D5B864ED2E72DB42002F5243 /* Presentation.swift */,
7375
D5B864EF2E72DC75002F5243 /* Controls.swift */,
76+
D5B864F12E72DCA7002F5243 /* UIViewRepresentable.swift */,
7477
D5B829742999738200920EBD /* Helpers.swift */,
7578
);
7679
path = Showcase;
@@ -156,6 +159,7 @@
156159
files = (
157160
D53071F929983CEF00F1936C /* AppView.swift in Sources */,
158161
D5B864EE2E72DB42002F5243 /* Presentation.swift in Sources */,
162+
D5B864F22E72DCA7002F5243 /* UIViewRepresentable.swift in Sources */,
159163
D5B864E82E72BF0F002F5243 /* ScrollView.swift in Sources */,
160164
D5B829752999738200920EBD /* Helpers.swift in Sources */,
161165
D5B864EC2E72D9E1002F5243 /* Navigation.swift in Sources */,

Examples/Showcase/Showcase/AppView.swift

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

61-
struct UIViewRepresentableShowcase: View {
62-
var body: some View {
63-
VStack(spacing: 10) {
64-
Text(".introspect(.view, ...)")
65-
.lineLimit(1)
66-
.minimumScaleFactor(0.5)
67-
.font(.system(.subheadline, design: .monospaced))
68-
#if os(iOS) || os(tvOS) || os(visionOS)
69-
.introspect(
70-
.view,
71-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
72-
) { view in
73-
view.backgroundColor = .cyan
74-
}
75-
#elseif os(macOS)
76-
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { view in
77-
view.layer?.backgroundColor = NSColor.cyan.cgColor
78-
}
79-
#endif
80-
81-
Button("A button", action: {})
82-
.padding(5)
83-
#if os(iOS) || os(tvOS) || os(visionOS)
84-
.introspect(
85-
.view,
86-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
87-
) { view in
88-
view.backgroundColor = .yellow
89-
}
90-
#elseif os(macOS)
91-
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { view in
92-
view.layer?.backgroundColor = NSColor.yellow.cgColor
93-
}
94-
#endif
95-
96-
Image(systemName: "scribble")
97-
#if os(iOS) || os(tvOS) || os(visionOS)
98-
.introspect(
99-
.view,
100-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
101-
) { view in
102-
view.backgroundColor = .blue
103-
}
104-
#elseif os(macOS)
105-
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { view in
106-
view.layer?.backgroundColor = NSColor.blue.cgColor
107-
}
108-
#endif
109-
}
110-
.padding()
111-
#if os(iOS) || os(tvOS) || os(visionOS)
112-
.introspect(
113-
.view,
114-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
115-
) { view in
116-
view.backgroundColor = .red
117-
}
118-
#elseif os(macOS)
119-
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { view in
120-
view.layer?.backgroundColor = NSColor.red.cgColor
121-
}
122-
#endif
123-
}
124-
}
125-
126-
struct ContentView_Previews: PreviewProvider {
127-
static var previews: some View {
128-
ContentView()
129-
}
61+
#Preview {
62+
ContentView()
13063
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import SwiftUI
2+
import SwiftUIIntrospect
3+
4+
struct UIViewRepresentableShowcase: View {
5+
var body: some View {
6+
VStack(spacing: 10) {
7+
Text(".introspect(.view, ...)")
8+
.lineLimit(1)
9+
.minimumScaleFactor(0.5)
10+
.font(.system(.subheadline, design: .monospaced))
11+
#if os(iOS) || os(tvOS) || os(visionOS)
12+
.introspect(
13+
.view,
14+
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
15+
) { view in
16+
view.backgroundColor = .cyan
17+
}
18+
#elseif os(macOS)
19+
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { view in
20+
view.layer?.backgroundColor = NSColor.cyan.cgColor
21+
}
22+
#endif
23+
24+
Button("A button", action: {})
25+
.padding(5)
26+
#if os(iOS) || os(tvOS) || os(visionOS)
27+
.introspect(
28+
.view,
29+
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
30+
) { view in
31+
view.backgroundColor = .yellow
32+
}
33+
#elseif os(macOS)
34+
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { view in
35+
view.layer?.backgroundColor = NSColor.yellow.cgColor
36+
}
37+
#endif
38+
39+
Image(systemName: "scribble")
40+
#if os(iOS) || os(tvOS) || os(visionOS)
41+
.introspect(
42+
.view,
43+
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
44+
) { view in
45+
view.backgroundColor = .blue
46+
}
47+
#elseif os(macOS)
48+
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { view in
49+
view.layer?.backgroundColor = NSColor.blue.cgColor
50+
}
51+
#endif
52+
}
53+
.padding()
54+
#if os(iOS) || os(tvOS) || os(visionOS)
55+
.introspect(
56+
.view,
57+
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
58+
) { view in
59+
view.backgroundColor = .red
60+
}
61+
#elseif os(macOS)
62+
.introspect(.view, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { view in
63+
view.layer?.backgroundColor = NSColor.red.cgColor
64+
}
65+
#endif
66+
}
67+
}

0 commit comments

Comments
 (0)