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 QuoteDetailPresenter: InteractorToPresenterQuoteDetailProtocol { | |
| func getImageFromURLSuccess(quote: APIQuote, data: Data?) { | |
| print("Presenter receives the result from Interactor after it's done its job.") | |
| view?.onGetImageFromURLSuccess(quote.quote!, character: quote.character!, image: ImageDataService.shared.convertToUIImage(from: data!)) | |
| } | |
| func getImageFromURLFailure(quote: APIQuote) { | |
| print("Presenter receives the result from Interactor after it's done its job.") |
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 QuoteDetailViewController: PresenterToViewQuoteDetailProtocol { | |
| func onGetImageFromURLSuccess(_ quote: String, character: String, image: UIImage) { | |
| print("View receives the response from Presenter and updates itself.") | |
| quoteLabel.text = quote | |
| characterImageView.image = image | |
| self.navigationItem.title = character | |
| } | |
| func onGetImageFromURLFailure(_ quote: String, character: 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 RxSwift | |
| open class ReactiveCoordinator<ResultType>: NSObject { | |
| public typealias CoordinationResult = ResultType | |
| public let disposeBag = DisposeBag() | |
| private let identifier = UUID() | |
| private var childCoordinators = [UUID: Any]() |
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 RxSwift | |
| import ReactiveCoordinator | |
| class AppCoordinator: ReactiveCoordinator<Void> { | |
| var window: UIWindow | |
| init(window: UIWindow) { | |
| self.window = window | |
| } |
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 | |
| import RxSwift | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? | |
| private var appCoordinator: AppCoordinator! | |
| 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
| import RxSwift | |
| import ReactiveCoordinator | |
| class HolidaysCoordinator: ReactiveCoordinator<Void> { | |
| let rootViewController: UIViewController | |
| init(rootViewController: UIViewController) { | |
| self.rootViewController = rootViewController | |
| } |
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 | |
| import PKHUD | |
| import RxSwift | |
| import RxCocoa | |
| import RxDataSources | |
| class HolidaysViewController: UIViewController { | |
| // MARK: - Lifecycle Methods |
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 | |
| class HolidayTableViewCell: UITableViewCell { | |
| // MARK: - Initialization | |
| override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | |
| super.init(style: style, | |
| reuseIdentifier: reuseIdentifier) | |
| } | |
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 RxSwift | |
| import RxCocoa | |
| class HolidaysViewModel { | |
| private let disposeBag = DisposeBag() | |
| // MARK: - Actions | |
| let isLoading = BehaviorSubject<Bool>(value: false) | |
| let selectedCountry = PublishSubject<String>() | |
| let selectedHoliday = PublishSubject<HolidayViewModel>() |
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 Foundation | |
| struct HolidayViewModel { | |
| let didClose = PublishSubject<Void>() | |
| let title: String | |
| let date: String | |
| let country: String | |
| let isPublic: Bool |