This file contains hidden or 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 | |
/// Extension used to facilitate adding child viewControllers in a viewController | |
public extension UIViewController { | |
/// Embeds a view controller and also adds it's view in the view hierarchay | |
/// | |
/// - Parameter viewController: ViewController to add | |
func add(asChildViewController viewController: UIViewController, anchored: Bool = true, subview: UIView? = nil) { | |
let someView: UIView = subview ?? view |
This file contains hidden or 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 | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
window = UIWindow(frame: UIScreen.main.bounds) | |
window?.backgroundColor = UIColor.white | |
window?.makeKeyAndVisible() |
This file contains hidden or 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 | |
open class MovieSearchViewController: UIViewController, UISearchResultsUpdating { | |
var service: MovieService = MovieStore.shared | |
// MARK: - Variables | |
private let movieSearchFetcherViewController = MovieSearchFetcherViewController() | |
private let searchController = UISearchController(searchResultsController: nil) | |
This file contains hidden or 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 | |
open class MovieSearchFetcherViewController: UIViewController { | |
var service: MovieService = MovieStore.shared | |
// MARK: - Variables | |
private let listStateViewController = ListStateViewController() | |
private let searchController = UISearchController(searchResultsController: nil) | |
This file contains hidden or 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 PlaygroundSupport | |
import UIKit | |
@testable import MVCMovieInfoFramework | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
NSSetUncaughtExceptionHandler { exception in | |
print("💥 Exception thrown: \(exception)") | |
} |
This file contains hidden or 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 | |
open class MovieListFetcherViewController: UIViewController { | |
// MARK: - Variables | |
public let listStateController = ListStateViewController() | |
public let movieStore = MovieStore.shared | |
public var endpoint: Endpoint = .nowPlaying { |
This file contains hidden or 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 | |
open class ListStateViewController: UIViewController { | |
public enum State { | |
case loading | |
case list([Listable]) | |
case empty(String) | |
case error(String) | |
} | |
This file contains hidden or 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 | |
open class LoadingViewController: UIViewController { | |
// MARK: - Variables | |
public let activityIndicator = UIActivityIndicatorView(style: .gray) | |
// MARK: - Lifecycle | |
open override func viewDidLoad() { |
This file contains hidden or 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 | |
open class ErrorViewController: UIViewController { | |
// MARK: - Variables | |
public let errorLabel = UILabel() | |
// MARK: - Lifecycle | |
This file contains hidden or 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 | |
open class MovieListCoordinator: UIViewController { | |
// MARK: - Variables | |
let segmentedController = SegmentedViewController() | |
let topMovieFetcherViewController = MovieListFetcherViewController() | |
let nowPlayingMovieFetcherViewController = MovieListFetcherViewController() | |
let popularMovieFetcherViewController = MovieListFetcherViewController() | |
let upcomingMovieFetcherViewController = MovieListFetcherViewController() |
NewerOlder