Skip to content

Instantly share code, notes, and snippets.

View zafarivaev's full-sized avatar
🎯
Focusing

Zafar Ivaev zafarivaev

🎯
Focusing
View GitHub Profile
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.")
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) {
import RxSwift
open class ReactiveCoordinator<ResultType>: NSObject {
public typealias CoordinationResult = ResultType
public let disposeBag = DisposeBag()
private let identifier = UUID()
private var childCoordinators = [UUID: Any]()
import RxSwift
import ReactiveCoordinator
class AppCoordinator: ReactiveCoordinator<Void> {
var window: UIWindow
init(window: UIWindow) {
self.window = window
}
import UIKit
import RxSwift
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
private var appCoordinator: AppCoordinator!
private let disposeBag = DisposeBag()
import RxSwift
import ReactiveCoordinator
class HolidaysCoordinator: ReactiveCoordinator<Void> {
let rootViewController: UIViewController
init(rootViewController: UIViewController) {
self.rootViewController = rootViewController
}
import UIKit
import PKHUD
import RxSwift
import RxCocoa
import RxDataSources
class HolidaysViewController: UIViewController {
// MARK: - Lifecycle Methods
import UIKit
class HolidayTableViewCell: UITableViewCell {
// MARK: - Initialization
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style,
reuseIdentifier: reuseIdentifier)
}
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>()
import Foundation
struct HolidayViewModel {
let didClose = PublishSubject<Void>()
let title: String
let date: String
let country: String
let isPublic: Bool