Skip to content

Instantly share code, notes, and snippets.

@trupin
Last active February 16, 2019 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trupin/89f3a1ec461a3cebbd5cef260317ab5b to your computer and use it in GitHub Desktop.
Save trupin/89f3a1ec461a3cebbd5cef260317ab5b to your computer and use it in GitHub Desktop.
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
private let dependencies: AppDelegateDependencyResolver = AppDelegateDependencyContainer()
// weaver: homeViewController = HomeViewController <- UIViewController
// weaver: urlSession = URLSession
// weaver: urlSession.scope = .container
// weaver: urlSession.builder = URLSession.make
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
window = UIWindow()
window?.rootViewController = UINavigationController(rootViewController: dependencies.homeViewController)
window?.makeKeyAndVisible()
return true
}
}
extension URLSession {
func make(_: AppDelegateDependencyResolver) -> URLSession {
return URLSession(configuration: .default)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment