Skip to content

Commit 6d8d72e

Browse files
This Adds the Enum Cases in the Node Generation Code for Interface.swift (#882)
* Added New Interface Stencil To House Node Protocols * Fixed If Statement in Template For Interface * Added comment to interface template * Remove extra new line * Removed Duplicate Declarations For Builder and Context * This adds the enums cases in the Node Generation Code for Interface.swift * Created New Stencil for SwiftUI Interface * removed new line * Fixed setup of interface files * Fixed Interface Stencil Layout * Removed duplicate calls from Builder-SwiftUI * Added new Enum Cases For SwiftUI Interface * This Adds the New and Updated Snapshots for Nodes that Include Interface.swift files (#883) * This adds the new and updated snapshots for Nodes that Include Interface.swift files * Regened snapshots for interface file with SwiftUI * Added missing import * Regened Snapshots for missing import
1 parent cb6dd2e commit 6d8d72e

File tree

139 files changed

+3174
-35
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+3174
-35
lines changed

Sources/NodesGenerator/PresetGenerator.swift

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public final class PresetGenerator {
4242
contextTestsImports: node.contextTests.imports(with: config),
4343
flowImports: node.flow.imports(with: config),
4444
flowTestsImports: node.flowTests.imports(with: config),
45+
interfaceImports: node.interface.imports(with: config),
4546
pluginImports: node.plugin.imports(with: config),
4647
pluginTestsImports: node.pluginTests.imports(with: config),
4748
stateImports: node.state.imports(with: config),
@@ -72,6 +73,7 @@ public final class PresetGenerator {
7273
contextTestsImports: node.contextTests.imports(with: config, including: uiFramework),
7374
flowImports: node.flow.imports(with: config, including: uiFramework),
7475
flowTestsImports: node.flowTests.imports(with: config, including: uiFramework),
76+
interfaceImports: node.interface.imports(with: config, including: uiFramework),
7577
stateImports: node.state.imports(with: config, including: uiFramework),
7678
viewControllerImports: node.viewController.imports(with: config, including: uiFramework),
7779
viewControllerTestsImports: node.viewControllerTests.imports(with: config, including: uiFramework),

Sources/NodesGenerator/StencilContexts/NodeStencilContext.swift

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public struct NodeStencilContext: StencilContext {
2424
private let contextTestsImports: [String]
2525
private let flowImports: [String]
2626
private let flowTestsImports: [String]
27+
private let interfaceImports: [String]
2728
private let pluginImports: [String]
2829
private let pluginTestsImports: [String]
2930
private let stateImports: [String]
@@ -74,6 +75,7 @@ public struct NodeStencilContext: StencilContext {
7475
"context_tests_imports": contextTestsImports,
7576
"flow_imports": flowImports,
7677
"flow_tests_imports": flowTestsImports,
78+
"interface_imports": interfaceImports,
7779
"plugin_imports": pluginImports,
7880
"plugin_tests_imports": pluginTestsImports,
7981
"state_imports": stateImports,
@@ -125,6 +127,7 @@ public struct NodeStencilContext: StencilContext {
125127
contextTestsImports: Set<String>,
126128
flowImports: Set<String>,
127129
flowTestsImports: Set<String>,
130+
interfaceImports: Set<String>,
128131
pluginImports: Set<String>,
129132
pluginTestsImports: Set<String>,
130133
stateImports: Set<String>,
@@ -174,6 +177,7 @@ public struct NodeStencilContext: StencilContext {
174177
contextTestsImports: contextTestsImports,
175178
flowImports: flowImports,
176179
flowTestsImports: flowTestsImports,
180+
interfaceImports: interfaceImports,
177181
pluginImports: pluginImports,
178182
pluginTestsImports: pluginTestsImports,
179183
stateImports: stateImports,
@@ -223,6 +227,7 @@ public struct NodeStencilContext: StencilContext {
223227
contextTestsImports: Set<String>,
224228
flowImports: Set<String>,
225229
flowTestsImports: Set<String>,
230+
interfaceImports: Set<String>,
226231
stateImports: Set<String>,
227232
viewControllerImports: Set<String>,
228233
viewControllerTestsImports: Set<String>,
@@ -271,6 +276,7 @@ public struct NodeStencilContext: StencilContext {
271276
contextTestsImports: contextTestsImports,
272277
flowImports: flowImports,
273278
flowTestsImports: flowTestsImports,
279+
interfaceImports: interfaceImports,
274280
pluginImports: [],
275281
pluginTestsImports: [],
276282
stateImports: stateImports,
@@ -322,6 +328,7 @@ public struct NodeStencilContext: StencilContext {
322328
contextTestsImports: Set<String>,
323329
flowImports: Set<String>,
324330
flowTestsImports: Set<String>,
331+
interfaceImports: Set<String>,
325332
pluginImports: Set<String>,
326333
pluginTestsImports: Set<String>,
327334
stateImports: Set<String>,
@@ -371,6 +378,7 @@ public struct NodeStencilContext: StencilContext {
371378
self.contextTestsImports = contextTestsImports.sortedImports()
372379
self.flowImports = flowImports.sortedImports()
373380
self.flowTestsImports = flowTestsImports.sortedImports()
381+
self.interfaceImports = interfaceImports.sortedImports()
374382
self.pluginImports = pluginImports.sortedImports()
375383
self.pluginTestsImports = pluginTestsImports.sortedImports()
376384
self.stateImports = stateImports.sortedImports()

Sources/NodesGenerator/StencilContexts/NodeViewInjectedStencilContext.swift

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public struct NodeViewInjectedStencilContext: StencilContext {
2020
private let contextTestsImports: [String]
2121
private let flowImports: [String]
2222
private let flowTestsImports: [String]
23+
private let interfaceImports: [String]
2324
private let pluginImports: [String]
2425
private let pluginTestsImports: [String]
2526
private let stateImports: [String]
@@ -49,6 +50,7 @@ public struct NodeViewInjectedStencilContext: StencilContext {
4950
"context_tests_imports": contextTestsImports,
5051
"flow_imports": flowImports,
5152
"flow_tests_imports": flowTestsImports,
53+
"interface_imports": interfaceImports,
5254
"plugin_imports": pluginImports,
5355
"plugin_tests_imports": pluginTestsImports,
5456
"state_imports": stateImports,
@@ -79,6 +81,7 @@ public struct NodeViewInjectedStencilContext: StencilContext {
7981
contextTestsImports: Set<String>,
8082
flowImports: Set<String>,
8183
flowTestsImports: Set<String>,
84+
interfaceImports: Set<String>,
8285
pluginImports: Set<String>,
8386
pluginTestsImports: Set<String>,
8487
stateImports: Set<String>,
@@ -107,6 +110,7 @@ public struct NodeViewInjectedStencilContext: StencilContext {
107110
contextTestsImports: contextTestsImports,
108111
flowImports: flowImports,
109112
flowTestsImports: flowTestsImports,
113+
interfaceImports: interfaceImports,
110114
pluginImports: pluginImports,
111115
pluginTestsImports: pluginTestsImports,
112116
stateImports: stateImports,
@@ -135,6 +139,7 @@ public struct NodeViewInjectedStencilContext: StencilContext {
135139
contextTestsImports: Set<String>,
136140
flowImports: Set<String>,
137141
flowTestsImports: Set<String>,
142+
interfaceImports: Set<String>,
138143
pluginImports: Set<String>,
139144
pluginTestsImports: Set<String>,
140145
stateImports: Set<String>,
@@ -164,6 +169,7 @@ public struct NodeViewInjectedStencilContext: StencilContext {
164169
contextTestsImports: contextTestsImports,
165170
flowImports: flowImports,
166171
flowTestsImports: flowTestsImports,
172+
interfaceImports: interfaceImports,
167173
pluginImports: pluginImports,
168174
pluginTestsImports: pluginTestsImports,
169175
stateImports: stateImports,
@@ -194,6 +200,7 @@ public struct NodeViewInjectedStencilContext: StencilContext {
194200
contextTestsImports: Set<String>,
195201
flowImports: Set<String>,
196202
flowTestsImports: Set<String>,
203+
interfaceImports: Set<String>,
197204
pluginImports: Set<String>,
198205
pluginTestsImports: Set<String>,
199206
stateImports: Set<String>,
@@ -222,6 +229,7 @@ public struct NodeViewInjectedStencilContext: StencilContext {
222229
self.contextTestsImports = contextTestsImports.sortedImports()
223230
self.flowImports = flowImports.sortedImports()
224231
self.flowTestsImports = flowTestsImports.sortedImports()
232+
self.interfaceImports = interfaceImports.sortedImports()
225233
self.pluginImports = pluginImports.sortedImports()
226234
self.pluginTestsImports = pluginTestsImports.sortedImports()
227235
self.stateImports = stateImports.sortedImports()

Sources/NodesGenerator/StencilTemplate.swift

+14
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
1818
case contextTests
1919
case flow
2020
case flowTests
21+
case interface(Variation)
2122
case plugin
2223
case pluginTests
2324
case pluginList
@@ -59,6 +60,7 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
5960
public let contextTests: StencilTemplate
6061
public let flow: StencilTemplate
6162
public let flowTests: StencilTemplate
63+
public let interface: StencilTemplate
6264
public let plugin: StencilTemplate
6365
public let pluginTests: StencilTemplate
6466
public let state: StencilTemplate
@@ -76,6 +78,7 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
7678
self.contextTests = .contextTests
7779
self.flow = .flow
7880
self.flowTests = .flowTests
81+
self.interface = .interface(variation)
7982
self.plugin = .plugin
8083
self.pluginTests = .pluginTests
8184
self.state = .state
@@ -91,6 +94,7 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
9194
builder,
9295
context,
9396
flow,
97+
interface,
9498
state,
9599
viewController,
96100
viewState
@@ -119,6 +123,7 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
119123
public let contextTests: StencilTemplate
120124
public let flow: StencilTemplate
121125
public let flowTests: StencilTemplate
126+
public let interface: StencilTemplate
122127
public let plugin: StencilTemplate
123128
public let pluginTests: StencilTemplate
124129
public let state: StencilTemplate
@@ -132,6 +137,7 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
132137
self.contextTests = .contextTests
133138
self.flow = .flow
134139
self.flowTests = .flowTests
140+
self.interface = .interface(.regular)
135141
self.plugin = .plugin
136142
self.pluginTests = .pluginTests
137143
self.state = .state
@@ -143,6 +149,7 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
143149
builder,
144150
context,
145151
flow,
152+
interface,
146153
state
147154
] + (includePlugin ? [.plugin] : [])
148155
guard includeTests
@@ -177,6 +184,8 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
177184
"Flow"
178185
case .flowTests:
179186
"FlowTests"
187+
case .interface:
188+
"Interface"
180189
case .plugin:
181190
"Plugin"
182191
case .pluginTests:
@@ -216,6 +225,8 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
216225
description
217226
case .plugin, .pluginTests:
218227
description
228+
case let .interface(variation):
229+
description.appending(variation.suffix)
219230
case .pluginList, .pluginListTests:
220231
description
221232
case .state:
@@ -259,6 +270,9 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable {
259270
.union(config.flowImports)
260271
case .flowTests:
261272
config.baseTestImports
273+
case .interface:
274+
config.baseImports
275+
.union(["Nodes"])
262276
case .plugin:
263277
config.baseImports
264278
.union(["Nodes"])

Sources/NodesGenerator/XcodeTemplatePermutations/NodeViewInjectedXcodeTemplatePermutation.swift

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ internal struct NodeViewInjectedXcodeTemplatePermutation: XcodeTemplatePermutati
3131
contextTestsImports: node.contextTests.imports(with: config),
3232
flowImports: node.flow.imports(with: config),
3333
flowTestsImports: node.flowTests.imports(with: config),
34+
interfaceImports: node.interface.imports(with: config),
3435
pluginImports: node.plugin.imports(with: config),
3536
pluginTestsImports: node.pluginTests.imports(with: config),
3637
stateImports: node.state.imports(with: config),

Sources/NodesGenerator/XcodeTemplatePermutations/NodeXcodeTemplatePermutation.swift

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ internal struct NodeXcodeTemplatePermutation: XcodeTemplatePermutation {
3434
contextTestsImports: node.contextTests.imports(with: config, including: uiFramework),
3535
flowImports: node.flow.imports(with: config, including: uiFramework),
3636
flowTestsImports: node.flowTests.imports(with: config, including: uiFramework),
37+
interfaceImports: node.interface.imports(with: config, including: uiFramework),
3738
pluginImports: node.plugin.imports(with: config, including: uiFramework),
3839
pluginTestsImports: node.pluginTests.imports(with: config, including: uiFramework),
3940
stateImports: node.state.imports(with: config, including: uiFramework),

Tests/NodesGeneratorTests/StencilRendererTests.swift

+9
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ final class StencilRendererTests: XCTestCase, TestFactories {
3030
"Builder",
3131
"Context",
3232
"Flow",
33+
"Interface",
3334
"State",
3435
"ViewController",
3536
"ViewState"
@@ -57,6 +58,7 @@ final class StencilRendererTests: XCTestCase, TestFactories {
5758
"Builder",
5859
"Context",
5960
"Flow",
61+
"Interface",
6062
"Plugin",
6163
"State",
6264
"ViewController",
@@ -89,6 +91,7 @@ final class StencilRendererTests: XCTestCase, TestFactories {
8991
"ContextTests",
9092
"Flow",
9193
"FlowTests",
94+
"Interface",
9295
"State",
9396
"ViewController",
9497
"ViewControllerTests",
@@ -122,6 +125,7 @@ final class StencilRendererTests: XCTestCase, TestFactories {
122125
"ContextTests",
123126
"Flow",
124127
"FlowTests",
128+
"Interface",
125129
"Plugin",
126130
"PluginTests",
127131
"State",
@@ -154,6 +158,7 @@ final class StencilRendererTests: XCTestCase, TestFactories {
154158
"ContextTests",
155159
"Flow",
156160
"FlowTests",
161+
"Interface",
157162
"State"
158163
]
159164
templates.forEach { name, template in
@@ -173,6 +178,7 @@ final class StencilRendererTests: XCTestCase, TestFactories {
173178
"Builder",
174179
"Context",
175180
"Flow",
181+
"Interface",
176182
"State"
177183
]
178184
templates.forEach { name, template in
@@ -194,6 +200,7 @@ final class StencilRendererTests: XCTestCase, TestFactories {
194200
"Builder",
195201
"Context",
196202
"Flow",
203+
"Interface",
197204
"State"
198205
]
199206
templates.forEach { name, template in
@@ -215,6 +222,7 @@ final class StencilRendererTests: XCTestCase, TestFactories {
215222
"Builder",
216223
"Context",
217224
"Flow",
225+
"Interface",
218226
"State"
219227
]
220228
templates.forEach { name, template in
@@ -235,6 +243,7 @@ final class StencilRendererTests: XCTestCase, TestFactories {
235243
"Builder",
236244
"Context",
237245
"Flow",
246+
"Interface",
238247
"State",
239248
"ViewController",
240249
"ViewState"

0 commit comments

Comments
 (0)