Skip to content

Commit d039865

Browse files
Added New Interface Stencil To House Node Protocols (#880)
* Added New Interface Stencil To House Node Protocols * Fixed If Statement in Template For Interface * Added comment to interface template * Remove extra new line * Created New Stencil for SwiftUI Interface * removed new line * Fixed setup of interface files * Fixed Interface Stencil Layout
1 parent 5dc40d6 commit d039865

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//{{ file_header }}
2+
{% if interface_imports %}
3+
4+
{% for import in interface_imports %}
5+
import {{ import }}
6+
{% endfor %}
7+
{% endif %}
8+
9+
// This file defines the protocols and types in the interface requiring public ACL for use in another module.
10+
{% if node_name != "App" %}
11+
12+
// MARK: - Listener
13+
14+
/// Defines the delegate protocol through which the `Context` interfaces with its listener.
15+
/// @mockable
16+
@MainActor
17+
internal protocol {{ node_name }}Listener: AnyObject {}
18+
{% endif %}
19+
20+
// MARK: - Flow
21+
22+
/// @mockable
23+
@MainActor
24+
{% if plugin_list_name %}
25+
internal protocol {{ node_name }}Flow: {{ plugin_list_name }}Flow {}
26+
{% else %}
27+
internal protocol {{ node_name }}Flow: {{ view_controllable_flow_type }} {}
28+
{% endif %}
29+
30+
// MARK: - Builder
31+
32+
{% if is_periphery_comment_enabled %}
33+
// periphery:ignore
34+
{% endif %}
35+
/// @mockable
36+
@MainActor
37+
{% if plugin_list_name %}
38+
internal protocol {{ node_name }}Builder: {{ plugin_list_name }}Builder {
39+
{% else %}
40+
internal protocol {{ node_name }}Builder: AnyObject {
41+
{% endif %}
42+
func build(
43+
withListener listener: {{ node_name }}Listener
44+
) -> {{ node_name }}Flow
45+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//{{ file_header }}
2+
{% if interface_imports %}
3+
4+
{% for import in interface_imports %}
5+
import {{ import }}
6+
{% endfor %}
7+
{% endif %}
8+
9+
// This file defines the protocols and types in the interface requiring public ACL for use in another module.
10+
{% if node_name != "App" %}
11+
12+
// MARK: - Listener
13+
14+
/// Defines the delegate protocol through which the `Context` interfaces with its listener.
15+
/// @mockable
16+
@MainActor
17+
internal protocol {{ node_name }}Listener: AnyObject {}
18+
{% endif %}
19+
20+
// MARK: - Flow
21+
22+
/// @mockable
23+
@MainActor
24+
{% if owns_view %}
25+
{% if plugin_list_name %}
26+
internal protocol {{ node_name }}Flow: {{ plugin_list_name }}Flow {}
27+
{% else %}
28+
internal protocol {{ node_name }}Flow: {{ view_controllable_flow_type }} {}
29+
{% endif %}
30+
{% elif node_name == "WindowScene" %}
31+
internal protocol {{ node_name }}Flow: Flow {
32+
func getViewController() -> {{ node_name }}ViewControllable
33+
}
34+
{% else %}
35+
internal protocol {{ node_name }}Flow: Flow {}
36+
{% endif %}
37+
38+
// MARK: - Builder
39+
40+
{% if is_periphery_comment_enabled %}
41+
// periphery:ignore
42+
{% endif %}
43+
/// @mockable
44+
@MainActor
45+
{% if plugin_list_name %}
46+
internal protocol {{ node_name }}Builder: {{ plugin_list_name }}Builder {
47+
func build(
48+
withListener listener: {{ node_name }}Listener
49+
) -> {{ node_name }}Flow
50+
}
51+
{% else %}
52+
internal protocol {{ node_name }}Builder: AnyObject {
53+
{% if node_name == "App" %}
54+
func build() -> {{ node_name }}Flow
55+
{% else %}
56+
func build(
57+
withListener listener: {{ node_name }}Listener{% if not owns_view %}{{ ',' }}
58+
viewController: {{ node_name }}ViewControllable{% endif +%}
59+
) -> {{ node_name }}Flow
60+
{% endif %}
61+
}
62+
{% endif %}

0 commit comments

Comments
 (0)