Skip to content

Instantly share code, notes, and snippets.

@giln
Created May 6, 2019 12:31
Show Gist options
  • Save giln/52e5b13d818a1c38f510dc497e8b8133 to your computer and use it in GitHub Desktop.
Save giln/52e5b13d818a1c38f510dc497e8b8133 to your computer and use it in GitHub Desktop.
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()
let listController = ListViewController()
let movieStore = MovieStore.shared
movieStore.fetchMovies(from: .topRated, params: nil, successHandler: { moviesResponse in
print(moviesResponse)
listController.list = moviesResponse.results
}) { error in
print(error)
}
window?.rootViewController = listController
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment