This file contains 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(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
window = UIWindow() |
This file contains 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
// MARK: - Error | |
enum MovieManagerError: Error { | |
case oops | |
} | |
// MARK: - Manager | |
protocol MovieManaging { | |
This file contains 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
struct Page<Model: Decodable>: Decodable { | |
let page: UInt | |
let total_results: UInt | |
let total_pages: UInt | |
let results: [Model] | |
} |
This file contains 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
struct Movie: Decodable { | |
let vote_count: UInt | |
let id: UInt | |
let video: Bool | |
let vote_average: Float | |
let title: String | |
let popularity: Float | |
let poster_path: String | |
let original_language: String | |
let original_title: String |
This file contains 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 | |
final class MovieTableViewCell: UITableViewCell { | |
struct ViewModel { | |
let title: String | |
} | |
func bind(_ viewModel: ViewModel) { | |
textLabel?.text = viewModel.title |
This file contains 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
final class MovieManager { | |
func getDiscoverMovies(_ completion: @escaping (Page<Movie>?) -> Void) { | |
let completionOnMainThread = { result in | |
DispatchQueue.main.async { | |
completion(result) | |
} | |
} | |
This file contains 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 | |
final class MovieTableViewCell: UITableViewCell { | |
struct ViewModel { | |
let title: String | |
} | |
func bind(_ viewModel: ViewModel) { | |
textLabel?.text = viewModel.title |
This file contains 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 | |
final class MovieViewController: UIViewController { | |
private let dependencies: MovieViewControllerDependencyResolver | |
// weaver: movie <= Movie | |
private lazy var overviewLabel: UILabel = { | |
let label = UILabel() |
This file contains 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 | |
final class MovieTableViewCell: UITableViewCell { | |
struct ViewModel { | |
let title: String | |
} | |
func bind(_ viewModel: ViewModel) { | |
textLabel?.text = viewModel.title |
This file contains 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 | |
final class ImageManager { | |
func getImage(with path: String, completion: @escaping (UIImage?) -> Void) { | |
let completionOnMainThread = { result in | |
DispatchQueue.main.async { | |
completion(result) | |
} |