Skip to content

Commit ddef285

Browse files
Use triple slash comments in stencil templates
1 parent 00aacd4 commit ddef285

File tree

12 files changed

+243
-336
lines changed

12 files changed

+243
-336
lines changed

Sources/NodesGenerator/Resources/Stencils/Analytics.stencil

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,25 @@ import {{ import }}
77
{% endif %}
88

99
/*
10-
INSTRUCTIONS:
11-
12-
Inject an existing analytics tracker (or client), that is defined outside of the Node, into the
13-
class defined in this file (below).
14-
15-
Inject the tracker (or client) via a protocol. The protocol for the injected tracker (or client)
16-
can either be an existing one defined outside of the Node or can be a new one added to this file.
10+
* INSTRUCTIONS:
11+
*
12+
* Inject an existing analytics tracker (or client), that is defined outside of the Node, into the
13+
* class defined in this file (below).
14+
*
15+
* Inject the tracker (or client) via a protocol. The protocol for the injected tracker (or client)
16+
* can either be an existing one defined outside of the Node or can be a new one added to this file.
17+
*
1718
*/
1819

19-
/**
20-
PURPOSE:
21-
The interface for analytics tracked by this Node.
22-
23-
Add requirements to this protocol to provide analytics tracking methods for this Node.
24-
*/
20+
/// PURPOSE:
21+
/// The interface for analytics tracked by this Node.
22+
///
23+
/// Add requirements to this protocol to provide analytics tracking methods for this Node.
2524
/// @mockable
2625
internal protocol {{ node_name }}Analytics: AnyObject {}
2726

28-
/**
29-
PURPOSE:
30-
Custom analytics implementation for this Node.
31-
*/
27+
/// PURPOSE:
28+
/// Custom analytics implementation for this Node.
3229
{% if analytics_properties %}
3330
internal final class {{ node_name }}AnalyticsImp {
3431

Sources/NodesGenerator/Resources/Stencils/Builder-SwiftUI.stencil

Lines changed: 49 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import {{ import }}
66
{% endfor %}
77
{% endif %}
88

9-
/**
10-
PURPOSE:
11-
The interface of the Flow.
12-
*/
9+
/// PURPOSE:
10+
/// The interface of the Flow.
1311
/// @mockable
1412
@MainActor
1513
{% if plugin_list_name %}
@@ -18,10 +16,8 @@ internal protocol {{ node_name }}Flow: {{ plugin_list_name }}Flow {}
1816
internal protocol {{ node_name }}Flow: {{ view_controllable_flow_type }} {}
1917
{% endif %}
2018

21-
/**
22-
PURPOSE:
23-
Declares the dependencies required by this Node that will be injected (not created by this Node itself).
24-
*/
19+
/// PURPOSE:
20+
/// Declares the dependencies required by this Node that will be injected (not created by this Node itself).
2521
/// @mockable
2622
@MainActor
2723
{% if dependencies %}
@@ -34,56 +30,50 @@ public protocol {{ node_name }}Dependency: Dependency {
3430
public protocol {{ node_name }}Dependency: Dependency {}
3531
{% endif %}
3632

37-
/**
38-
PURPOSE:
39-
A dependency needed by the Builder (such as a Listener), passed in from the caller (i.e. is not on the DI graph).
40-
41-
Can be a tuple or struct containing multiple values when necessary.
42-
*/
33+
/// PURPOSE:
34+
/// A dependency needed by the Builder (such as a Listener), passed in from the caller (i.e. is not on the DI graph).
35+
///
36+
/// Can be a tuple or struct containing multiple values when necessary.
4337
internal typealias {{ node_name }}DynamicBuildDependency = {{ node_name }}Listener
4438

45-
/**
46-
PURPOSE:
47-
A dependency used by the Component itself, passed into the Component's initializer (in the Component factory).
48-
49-
Can be a tuple or struct containing multiple values when necessary.
50-
*/
39+
/// PURPOSE:
40+
/// A dependency used by the Component itself, passed into the Component's initializer (in the Component factory).
41+
///
42+
/// Can be a tuple or struct containing multiple values when necessary.
5143
internal typealias {{ node_name }}DynamicComponentDependency = Void
5244

5345
// MARK: - Component
5446

55-
/**
56-
PURPOSE:
57-
Declares dependencies that are owned by this Node.
58-
*/
47+
/// PURPOSE:
48+
/// Declares dependencies that are owned by this Node.
5949
public final class {{ node_name }}Component: Component
6050
<
6151
{{ node_name }}Dependency
6252
> {
6353

6454
/*
65-
Dependencies
66-
============
67-
68-
Declare dependencies as 'fileprivate' properties (increasing access control only as necessary).
69-
70-
fileprivate let example: Example = .init()
71-
72-
Whenever possible, for example when the dependency does not provide shared state, define the property as a
73-
factory that always returns a new instance. Factory properties are preferred over factory methods to ensure
74-
Needle compatibility whenever the access control is increased.
75-
76-
fileprivate var exampleFactory: Example {
77-
Example()
78-
}
79-
80-
When shared state is desired but the dependency depends on another dependency, use the `shared` helper method
81-
that always returns the same instance from a computed property.
82-
83-
fileprivate var example: Example {
84-
shared { Example(otherDependency: dependency.otherDependency) }
85-
}
86-
55+
* Dependencies
56+
* ============
57+
*
58+
* Declare dependencies as 'fileprivate' properties (increasing access control only as necessary).
59+
*
60+
* fileprivate let example: Example = .init()
61+
*
62+
* Whenever possible, for example when the dependency does not provide shared state, define the property as a
63+
* factory that always returns a new instance. Factory properties are preferred over factory methods to ensure
64+
* Needle compatibility whenever the access control is increased.
65+
*
66+
* fileprivate var exampleFactory: Example {
67+
* Example()
68+
* }
69+
*
70+
* When shared state is desired but the dependency depends on another dependency, use the `shared` helper method
71+
* that always returns the same instance from a computed property.
72+
*
73+
* fileprivate var example: Example {
74+
* shared { Example(otherDependency: dependency.otherDependency) }
75+
* }
76+
*
8777
*/
8878
{% if component_dependencies %}
8979

@@ -114,15 +104,15 @@ public final class {{ node_name }}Component: Component
114104
}
115105

116106
/*
117-
Child Components
118-
================
119-
120-
Declare child component factories as 'fileprivate' methods.
121-
122-
fileprivate func <nodeName>ComponentFactory() -> ChildComponent {
123-
ChildComponent(parent: self)
124-
}
125-
107+
* Child Components
108+
* ================
109+
*
110+
* Declare child component factories as 'fileprivate' methods.
111+
*
112+
* fileprivate func <nodeName>ComponentFactory() -> ChildComponent {
113+
* ChildComponent(parent: self)
114+
* }
115+
*
126116
*/
127117
}
128118

@@ -131,10 +121,8 @@ public final class {{ node_name }}Component: Component
131121
{% if is_periphery_comment_enabled %}
132122
// periphery:ignore
133123
{% endif %}
134-
/**
135-
PURPOSE:
136-
The Builder interface (available to mock for testability).
137-
*/
124+
/// PURPOSE:
125+
/// The Builder interface (available to mock for testability).
138126
/// @mockable
139127
@MainActor
140128
{% if plugin_list_name %}
@@ -150,10 +138,8 @@ internal protocol {{ node_name }}Builder: AnyObject {
150138
{% if is_periphery_comment_enabled %}
151139
// periphery:ignore
152140
{% endif %}
153-
/**
154-
PURPOSE:
155-
Concrete implementation of the Builder, where everything is created and associated.
156-
*/
141+
/// PURPOSE:
142+
/// Concrete implementation of the Builder, where everything is created and associated.
157143
internal final class {{ node_name }}BuilderImp: AbstractBuilder
158144
<
159145
{{ node_name }}Component,

Sources/NodesGenerator/Resources/Stencils/Builder.stencil

Lines changed: 49 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import {{ import }}
66
{% endfor %}
77
{% endif %}
88

9-
/**
10-
PURPOSE:
11-
The interface of the Flow.
12-
*/
9+
/// PURPOSE:
10+
/// The interface of the Flow.
1311
/// @mockable
1412
@MainActor
1513
{% if owns_view %}
@@ -27,10 +25,8 @@ internal protocol {{ node_name }}Flow: Flow {}
2725
{% endif %}
2826
{% if node_name != "App" %}
2927

30-
/**
31-
PURPOSE:
32-
Declares the dependencies required by this Node that will be injected (not created by this Node itself).
33-
*/
28+
/// PURPOSE:
29+
/// Declares the dependencies required by this Node that will be injected (not created by this Node itself).
3430
/// @mockable
3531
@MainActor
3632
{% if dependencies %}
@@ -44,12 +40,10 @@ public protocol {{ node_name }}Dependency: Dependency {}
4440
{% endif %}
4541
{% endif %}
4642

47-
/**
48-
PURPOSE:
49-
A dependency needed by the Builder (such as a Listener), passed in from the caller (i.e. is not on the DI graph).
50-
51-
Can be a tuple or struct containing multiple values when necessary.
52-
*/
43+
/// PURPOSE:
44+
/// A dependency needed by the Builder (such as a Listener), passed in from the caller (i.e. is not on the DI graph).
45+
///
46+
/// Can be a tuple or struct containing multiple values when necessary.
5347
{% if owns_view %}
5448
internal typealias {{ node_name }}DynamicBuildDependency = {{ node_name }}Listener
5549
{% elif node_name == "App" %}
@@ -58,20 +52,16 @@ internal typealias {{ node_name }}DynamicBuildDependency = Void
5852
internal typealias {{ node_name }}DynamicBuildDependency = ({{ node_name }}Listener, {{ node_name }}ViewControllable)
5953
{% endif %}
6054

61-
/**
62-
PURPOSE:
63-
A dependency used by the Component itself, passed into the Component's initializer (in the Component factory).
64-
65-
Can be a tuple or struct containing multiple values when necessary.
66-
*/
55+
/// PURPOSE:
56+
/// A dependency used by the Component itself, passed into the Component's initializer (in the Component factory).
57+
///
58+
/// Can be a tuple or struct containing multiple values when necessary.
6759
internal typealias {{ node_name }}DynamicComponentDependency = Void
6860

6961
// MARK: - Component
7062

71-
/**
72-
PURPOSE:
73-
Declares dependencies that are owned by this Node.
74-
*/
63+
/// PURPOSE:
64+
/// Declares dependencies that are owned by this Node.
7565
{% if node_name == "App" %}
7666
public final class {{ node_name }}Component: BootstrapComponent {
7767
{% else %}
@@ -82,28 +72,28 @@ public final class {{ node_name }}Component: Component
8272
{% endif %}
8373

8474
/*
85-
Dependencies
86-
============
87-
88-
Declare dependencies as 'fileprivate' properties (increasing access control only as necessary).
89-
90-
fileprivate let example: Example = .init()
91-
92-
Whenever possible, for example when the dependency does not provide shared state, define the property as a
93-
factory that always returns a new instance. Factory properties are preferred over factory methods to ensure
94-
Needle compatibility whenever the access control is increased.
95-
96-
fileprivate var exampleFactory: Example {
97-
Example()
98-
}
99-
100-
When shared state is desired but the dependency depends on another dependency, use the `shared` helper method
101-
that always returns the same instance from a computed property.
102-
103-
fileprivate var example: Example {
104-
shared { Example(otherDependency: dependency.otherDependency) }
105-
}
106-
75+
* Dependencies
76+
* ============
77+
*
78+
* Declare dependencies as 'fileprivate' properties (increasing access control only as necessary).
79+
*
80+
* fileprivate let example: Example = .init()
81+
*
82+
* Whenever possible, for example when the dependency does not provide shared state, define the property as a
83+
* factory that always returns a new instance. Factory properties are preferred over factory methods to ensure
84+
* Needle compatibility whenever the access control is increased.
85+
*
86+
* fileprivate var exampleFactory: Example {
87+
* Example()
88+
* }
89+
*
90+
* When shared state is desired but the dependency depends on another dependency, use the `shared` helper method
91+
* that always returns the same instance from a computed property.
92+
*
93+
* fileprivate var example: Example {
94+
* shared { Example(otherDependency: dependency.otherDependency) }
95+
* }
96+
*
10797
*/
10898
{% if component_dependencies %}
10999

@@ -144,15 +134,15 @@ public final class {{ node_name }}Component: Component
144134
}
145135

146136
/*
147-
Child Components
148-
================
149-
150-
Declare child component factories as 'fileprivate' methods.
151-
152-
fileprivate func <name>ComponentFactory() -> <Name>Component {
153-
<Name>Component(parent: self)
154-
}
155-
137+
* Child Components
138+
* ================
139+
*
140+
* Declare child component factories as 'fileprivate' methods.
141+
*
142+
* fileprivate func <name>ComponentFactory() -> <Name>Component {
143+
* <Name>Component(parent: self)
144+
* }
145+
*
156146
*/
157147
{% if node_name == "App" %}
158148

@@ -177,10 +167,8 @@ public final class {{ node_name }}Component: Component
177167
{% if is_periphery_comment_enabled %}
178168
// periphery:ignore
179169
{% endif %}
180-
/**
181-
PURPOSE:
182-
The Builder interface (available to mock for testability).
183-
*/
170+
/// PURPOSE:
171+
/// The Builder interface (available to mock for testability).
184172
/// @mockable
185173
@MainActor
186174
{% if plugin_list_name %}
@@ -205,10 +193,8 @@ internal protocol {{ node_name }}Builder: AnyObject {
205193
{% if is_periphery_comment_enabled %}
206194
// periphery:ignore
207195
{% endif %}
208-
/**
209-
PURPOSE:
210-
Concrete implementation of the Builder, where everything is created and associated.
211-
*/
196+
/// PURPOSE:
197+
/// Concrete implementation of the Builder, where everything is created and associated.
212198
internal final class {{ node_name }}BuilderImp: AbstractBuilder
213199
<
214200
{{ node_name }}Component,

0 commit comments

Comments
 (0)