-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathAppDelegate.swift
37 lines (30 loc) · 1.2 KB
/
AppDelegate.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// AppDelegate.swift
// Example
//
// Created by Nacho Soto on 11/30/18.
// Copyright © 2018 Nacho Soto. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let images = ImagesViewController(fetcher: ImageFetcher())
let navigationController = UINavigationController(rootViewController: images)
self.window = UIWindow()
self.window!.rootViewController = navigationController
self.window!.makeKeyAndVisible()
self.configureEvents(imagesViewController: images,
navigationController: navigationController)
return true
}
private func configureEvents(
imagesViewController: ImagesViewController,
navigationController: UINavigationController
) {
imagesViewController.openImageRequests
.map(FullScreenImageViewController.init)
.observeValues { navigationController.pushViewController($0, animated: true) }
}
}