Files
letro-ios/ElementX/Sources/AppDelegate.swift
Stefan Ceriu fa52e5bb3a Small tweaks.
2022-04-30 09:41:52 +03:00

50 lines
1.3 KiB
Swift

//
// AppDelegate.swift
// ElementX
//
// Created by Stefan Ceriu on 11.02.2022.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
private lazy var appCoordinator: Coordinator = isRunningUITests ? UITestsAppCoordinator() : AppCoordinator()
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
// fixme: Use `Bundle.elementLanguage = ".."` when we have the functionality
// use `en` as fallback language
Bundle.elementFallbackLanguage = "en"
return true
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
if isRunningUnitTests {
return true
}
appCoordinator.start()
return true
}
private var isRunningUnitTests: Bool {
#if DEBUG
ProcessInfo.processInfo.environment["IS_RUNNING_UNIT_TESTS"] == "1"
#else
false
#endif
}
private var isRunningUITests: Bool {
#if DEBUG
ProcessInfo.processInfo.environment["IS_RUNNING_UI_TESTS"] == "1"
#else
false
#endif
}
}