From 320ff85896ef17f8e54ce44c3b71df15fda9d43c Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Fri, 3 Jun 2022 09:14:25 -0700 Subject: [PATCH 1/2] Avoid app flow and provider factories in tests --- genesis.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/genesis.yml b/genesis.yml index 7956f2723..600f94e81 100644 --- a/genesis.yml +++ b/genesis.yml @@ -294,18 +294,16 @@ files: @main internal final class AppDelegate: UIResponder, UIApplicationDelegate { - private let appFlow: AppFlow - - override internal init() { - registerProviderFactories() - appFlow = AppBuilderImp { AppComponent() }.build() - } + private lazy var appFlow: AppFlow = AppBuilderImp { AppComponent() }.build() internal func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - appFlow.start() + if NSClassFromString("XCTestCase") == nil { + registerProviderFactories() + appFlow.start() + } return true } } From 497ce2192635dd02e549fc06ec2d388b34208665 Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Sun, 5 Jun 2022 08:03:57 -0700 Subject: [PATCH 2/2] Add bootstrap method --- genesis.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/genesis.yml b/genesis.yml index 600f94e81..35b5f7399 100644 --- a/genesis.yml +++ b/genesis.yml @@ -300,12 +300,16 @@ files: _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - if NSClassFromString("XCTestCase") == nil { - registerProviderFactories() - appFlow.start() - } + bootstrap() return true } + + private func bootstrap() { + guard NSClassFromString("XCTestCase") == nil + else { return } + registerProviderFactories() + appFlow.start() + } } - path: "{{ project|split:' '|join:'_' }}/Sources/SceneDelegate.swift"