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
| /** | |
| Gets Movie data from themoviedb.org api | |
| */ | |
| protocol ApiThemoviedbMoviesProvider { | |
| /** | |
| Fetches popular movies from themoviedb.org api | |
| - Returns: Optional observable array of 'Movie' type | |
| */ | |
| func fetchPopularMovies() -> Observable<[Movie]?> |
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
| /** | |
| Service communicates with themoviedb.org api | |
| Consists of separate providers | |
| */ | |
| protocol ApiThemoviedbService: ApiThemoviedbMoviesProvider, | |
| ApiThemoviedbTVShowsProvider, | |
| ApiThemoviedbAuthProvider { | |
| } |
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
| class ItemDetailViewController: UIViewController { | |
| @IBOutlet private weak var headerView: ItemDetailHeaderView! | |
| @IBOutlet private weak var videoView: ItemDetailVideoView! | |
| @IBOutlet private weak var tipsView: ItemDetailTipsView! | |
| @IBOutlet private weak var posterImageView: GradientImageView! | |
| @IBOutlet private weak var backButton: UIButton! | |
| var viewModel: ItemDetailViewModel? | |
| private let disposeBag = DisposeBag() |
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
| final class ItemDetailViewModel: ViewModelType { | |
| struct Input { | |
| let ready: Driver<Void> | |
| let backTrigger: Driver<Void> | |
| } | |
| struct Output { | |
| let data: Driver<ItemDetailData?> | |
| let mediaData: Driver<AdditionalMediaItemDetailData?> |
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
| /** | |
| Type to describe view model | |
| Consists of: | |
| Input: struct describing input parameters | |
| Output: struct describing output parameters | |
| Dependencies: services required for correct data processing inside a view model | |
| Transform: transforming method | |
| */ | |
| protocol ViewModelType { | |
| /** |
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
| class ItemDetailVideoView: UIView { | |
| @IBOutlet private weak var trailerTitleLabel: UILabel! | |
| @IBOutlet private weak var trailerSubtitleLabel: UILabel! | |
| @IBOutlet private weak var videoPlayerView: VideoPlayerView! | |
| @IBOutlet private var contentView: UIView! | |
| override init(frame: CGRect) { | |
| super.init(frame: frame) | |
| setup() |
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
| /** | |
| Data struct model for Movie | |
| Detail description: https://developers.themoviedb.org/3/movies/get-movie-details | |
| */ | |
| struct Movie: Decodable { | |
| let budget: Int? | |
| let genres: [Genre]? | |
| let homepage: String? | |
| let movieId: Int | |
| let imdbId: 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
| extension ApplicationCoordinator: FeaturedCoordinatorDelegate { | |
| /** | |
| Invoked when the featured flow is no longer needed. | |
| */ | |
| func featuredCoordinatorDidFinish() { | |
| dLog("ApplicationCoordinator:: childCoordinators[.featured] = nil") | |
| childCoordinators[.featured] = nil | |
| navigationController.popViewController(animated: true) |
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
| /** | |
| Parent delegate protocol for FeaturedCoordinator. | |
| Should be implemented by parent Coordinator who invoked FeaturedCoordinator. | |
| */ | |
| protocol FeaturedCoordinatorDelegate: AnyObject { | |
| /** | |
| Invoked when the featured flow is no longer needed | |
| Coordinator never finishes by itself, | |
| but calls its Parent Coordinator only when it finished work. |
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
| /** | |
| Parent delegate protocol for Coordinator. | |
| Should be implemented by Parent Coordinator who invoked Coordinator. | |
| */ | |
| protocol CoordinatorDelegate: AnyObject { | |
| /** | |
| Invoked when the Coordinator is no longer needed | |
| Coordinator never finishes by itself, | |
| but calls its Parent Coordinator only when it finished work. |