diff --git a/Sources/NodesGenerator/Resources/Stencils/Flow.stencil b/Sources/NodesGenerator/Resources/Stencils/Flow.stencil index 6c2bb9cf9..25ed5d43b 100644 --- a/Sources/NodesGenerator/Resources/Stencils/Flow.stencil +++ b/Sources/NodesGenerator/Resources/Stencils/Flow.stencil @@ -18,6 +18,7 @@ internal protocol {{ node_name }}ContextInterface: Context, WindowListener {} internal protocol {{ node_name }}ContextInterface: Context, RootListener {} {% else %} internal protocol {{ node_name }}ContextInterface: Context {} +{% if owns_view %} /// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol /// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom @@ -28,6 +29,7 @@ internal protocol {{ node_name }}ContextInterface: Context {} @MainActor internal protocol {{ node_name }}ViewControllable: {{ view_controllable_type }} {} {% endif %} +{% endif %} internal final class {{ node_name }}FlowImp: AbstractFlow < diff --git a/Sources/NodesGenerator/Resources/Stencils/Interface.stencil b/Sources/NodesGenerator/Resources/Stencils/Interface.stencil index 4ee119536..9ed627405 100644 --- a/Sources/NodesGenerator/Resources/Stencils/Interface.stencil +++ b/Sources/NodesGenerator/Resources/Stencils/Interface.stencil @@ -16,6 +16,17 @@ import {{ import }} @MainActor internal protocol {{ node_name }}Listener: AnyObject {} {% endif %} +{% if node_name != "App" and node_name != "WindowScene" and node_name != "Window" and not owns_view %} + +/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol +/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom +/// presentation or containment as desired. +{% if not view_controllable_mock_contents %} +/// @mockable +{% endif %} +@MainActor +internal protocol {{ node_name }}ViewControllable: {{ view_controllable_type }} {} +{% endif %} /// @mockable @MainActor diff --git a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-0.txt b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-0.txt index 558c66002..aaf893b69 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-0.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-0.txt @@ -6,13 +6,6 @@ @MainActor internal protocol ContextInterface: Context {} -/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol -/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom -/// presentation or containment as desired. -/// @mockable -@MainActor -internal protocol ViewControllable: {} - internal final class FlowImp: AbstractFlow < ContextInterface, diff --git a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-1.txt b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-1.txt index af304d8df..f0fc8bf09 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-1.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-1.txt @@ -8,12 +8,6 @@ import @MainActor internal protocol ContextInterface: Context {} -/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol -/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom -/// presentation or containment as desired. -@MainActor -internal protocol ViewControllable: {} - internal final class FlowImp: AbstractFlow < ContextInterface, diff --git a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-2.txt b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-2.txt index c46e85e05..3af10e283 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-2.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Flow-mockCount-2.txt @@ -9,12 +9,6 @@ import @MainActor internal protocol ContextInterface: Context {} -/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol -/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom -/// presentation or containment as desired. -@MainActor -internal protocol ViewControllable: {} - internal final class FlowImp: AbstractFlow < ContextInterface, diff --git a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-0.txt b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-0.txt index ef5986ec5..e5667d4f2 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-0.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-0.txt @@ -9,6 +9,13 @@ @MainActor internal protocol Listener: AnyObject {} +/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol +/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom +/// presentation or containment as desired. +/// @mockable +@MainActor +internal protocol ViewControllable: {} + /// @mockable @MainActor internal protocol Flow: Flow {} diff --git a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-1.txt b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-1.txt index c632d4e1f..18604b666 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-1.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-1.txt @@ -11,6 +11,12 @@ import @MainActor internal protocol Listener: AnyObject {} +/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol +/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom +/// presentation or containment as desired. +@MainActor +internal protocol ViewControllable: {} + /// @mockable @MainActor internal protocol Flow: Flow {} diff --git a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-2.txt b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-2.txt index ad65ff52b..f59a81bb4 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-2.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/StencilRendererTests/testRenderNodeViewInjected.Interface-mockCount-2.txt @@ -12,6 +12,12 @@ import @MainActor internal protocol Listener: AnyObject {} +/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol +/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom +/// presentation or containment as desired. +@MainActor +internal protocol ViewControllable: {} + /// @mockable @MainActor internal protocol Flow: Flow {} diff --git a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithIdentifier.Contents-ViewInjected-Flow.txt b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithIdentifier.Contents-ViewInjected-Flow.txt index 81b2ebea0..10f64e266 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithIdentifier.Contents-ViewInjected-Flow.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithIdentifier.Contents-ViewInjected-Flow.txt @@ -8,13 +8,6 @@ import Nodes @MainActor internal protocol ___VARIABLE_productName___ContextInterface: Context {} -/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol -/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom -/// presentation or containment as desired. -/// @mockable -@MainActor -internal protocol ___VARIABLE_productName___ViewControllable: ViewControllable {} - internal final class ___VARIABLE_productName___FlowImp: AbstractFlow < ___VARIABLE_productName___ContextInterface, diff --git a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithIdentifier.Contents-ViewInjected-Interface.txt b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithIdentifier.Contents-ViewInjected-Interface.txt index 6df76b443..ccf913b89 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithIdentifier.Contents-ViewInjected-Interface.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithIdentifier.Contents-ViewInjected-Interface.txt @@ -11,6 +11,13 @@ import Nodes @MainActor internal protocol ___VARIABLE_productName___Listener: AnyObject {} +/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol +/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom +/// presentation or containment as desired. +/// @mockable +@MainActor +internal protocol ___VARIABLE_productName___ViewControllable: ViewControllable {} + /// @mockable @MainActor internal protocol ___VARIABLE_productName___Flow: Flow {} diff --git a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithURL.Contents-ViewInjected-Flow.txt b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithURL.Contents-ViewInjected-Flow.txt index 81b2ebea0..10f64e266 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithURL.Contents-ViewInjected-Flow.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithURL.Contents-ViewInjected-Flow.txt @@ -8,13 +8,6 @@ import Nodes @MainActor internal protocol ___VARIABLE_productName___ContextInterface: Context {} -/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol -/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom -/// presentation or containment as desired. -/// @mockable -@MainActor -internal protocol ___VARIABLE_productName___ViewControllable: ViewControllable {} - internal final class ___VARIABLE_productName___FlowImp: AbstractFlow < ___VARIABLE_productName___ContextInterface, diff --git a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithURL.Contents-ViewInjected-Interface.txt b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithURL.Contents-ViewInjected-Interface.txt index 6df76b443..ccf913b89 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithURL.Contents-ViewInjected-Interface.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateGeneratorTests/testGenerateWithURL.Contents-ViewInjected-Interface.txt @@ -11,6 +11,13 @@ import Nodes @MainActor internal protocol ___VARIABLE_productName___Listener: AnyObject {} +/// Defines the interface between the `Flow` and its view in order to present or contain other views. This protocol +/// typically inherits protocols that include pre-defined behavior for convenience. Add additional methods for custom +/// presentation or containment as desired. +/// @mockable +@MainActor +internal protocol ___VARIABLE_productName___ViewControllable: ViewControllable {} + /// @mockable @MainActor internal protocol ___VARIABLE_productName___Flow: Flow {}