Created
May 6, 2019 12:36
-
-
Save giln/f4603225d30973250764d2fd1fafe3f9 to your computer and use it in GitHub Desktop.
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 MovieFetcherViewController: UIViewController { | |
// MARK: - Variables | |
public var movieStore = MovieStore.shared | |
private let listController = ListViewController() | |
// MARK: - Lifecycle | |
open override func viewDidLoad() { | |
super.viewDidLoad() | |
add(asChildViewController: listController) | |
} | |
open override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
movieStore.fetchMovies(from: .topRated, params: nil, successHandler: { [weak self] moviesResponse in | |
self?.listController.list = moviesResponse.results | |
}) { error in | |
print(error) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment