Last active
September 15, 2019 07:43
-
-
Save iharkatkavets/c0e29f354af091646404daabfa292a10 to your computer and use it in GitHub Desktop.
Xcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Swinject | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
let diResolver = { | |
Assembler([CoreAssembly(), | |
MainAssembly(), | |
PasswordAssembly(), | |
FilesListAssembly()]).resolver | |
}() | |
var window: UIWindow? = {UIWindow(frame: UIScreen.main.bounds)}() | |
func application(_ application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
window?.rootViewController = diResolver.resolve(MainViewInput.self)?.getViewController() | |
// if let controller = diResolver.resolve(PasswordViewInterface.self)?.viewController { | |
// let navigationController = UINavigationController(rootViewController: controller) | |
// navigationController.isNavigationBarHidden = true | |
// window?.rootViewController = navigationController | |
// } | |
self.window?.makeKeyAndVisible() | |
return true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Swinject | |
class CoreAssembly: Assembly { | |
func assemble(container: Container) { | |
container.register(LauncherInput.self) { | |
return Launcher(withResolver: $0) | |
} | |
container.register(DatabaseStoreInput.self) { resolver in | |
return resolver.resolve(DatabaseDataForScreenshotsInput.self)! | |
} | |
container.register(FilesStoreInput.self) { _ in | |
let documentsUrl = FileManager.default.urls(for: .documentDirectory, in:.userDomainMask).first! | |
return FilesStore(withDirURL: documentsUrl) | |
} | |
container.register(ImageReaderInput.self) { _ in | |
return ImageReader(withDefault: #imageLiteral(resourceName: "no_photo")) | |
} | |
container.register(ServicesPoolInput.self) { rlr in | |
return ExternalServicesPool(with: container) | |
} | |
.inObjectScope(.weak) | |
container.register(AdBannerIdentifiers.self) { _ in | |
return AdBannerIdentifiers() | |
} | |
container.register(AppConfigsInput.self) { _ in | |
return AppConfigs() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment