Skip to content

Instantly share code, notes, and snippets.

@noxt
Created February 19, 2019 11:50
Show Gist options
  • Save noxt/773004208f67245c88ea53ad3c074b61 to your computer and use it in GitHub Desktop.
Save noxt/773004208f67245c88ea53ad3c074b61 to your computer and use it in GitHub Desktop.
AppDelegate
// App/AppDelegate.swift
import Unicore
typealias AppCore = Core<AppFeature.State>
let core = AppCore(state: .initial, reducer: AppFeature.reduce)
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
private let repositories = RepositoryProvider()
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
let mainScene = MainScreenScene.makeScene(with: repositories)
window = UIWindow()
window?.rootViewController = UINavigationController(rootViewController: mainScene.component)
window?.makeKeyAndVisible()
return true
}
func applicationWillEnterForeground(_ application: UIApplication) {
core.dispatch(AppFeature.Actions.willEnterForeground)
}
func applicationDidEnterBackground(_ application: UIApplication) {
core.dispatch(AppFeature.Actions.didEnterBackground)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment