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 Services { | |
| class func avgPrice(symbol: String, completion: @escaping(Swift.Result<AveragePriceResponseModel, ErrorModel>) -> Void) { | |
| ServiceManager.shared.sendRequest(request: AveragePriceRequestModel(symbol: symbol)) { (result) in | |
| completion(result) | |
| } | |
| } | |
| } |
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 HomeController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| Services.avgPrice(symbol: "BTCUSDT") { result in | |
| switch result { | |
| case Result.success(let response): | |
| // Handle successfull response | |
| break |
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 SwiftUI | |
| struct ContentView: View { | |
| var baseURL: String { | |
| #if DEBUG | |
| return "This is DEBUG base URL" | |
| #elseif TEST | |
| return "This is TEST base URL" | |
| #elseif RELEASE |
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
| // MARK: Wireframe | |
| protocol ContactDetailWireframeProtocol: class {} | |
| // MARK: Presenter | |
| protocol ContactDetailPresenterProtocol: class { | |
| var interactor: ContactDetailInteractorInputProtocol! { get set } | |
| func getContact() | |
| } |
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 ContactDetailPresenter { | |
| var view: ContactDetailViewProtocol! | |
| var interactor: ContactDetailInteractorInputProtocol! | |
| var router: ContactDetailWireframeProtocol! | |
| var data: Any? | |
| } | |
| extension ContactDetailPresenter: ContactDetailPresenterProtocol { | |
| func getContact() { |
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 ContactDetailTableController: UITableViewController { | |
| var presenter: ContactDetailPresenterProtocol! | |
| var contact: Contact! | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| presenter.getContact() | |
| } |
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 HomeRouter: NSObject { | |
| var controller: HomeTableController! | |
| var presenter: HomePresenter! | |
| var interactor: HomeInteractor! | |
| required override init() { | |
| super.init() | |
| interactor = HomeInteractor() | |
| presenter = HomePresenter() |
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 ContactDetailRouter: NSObject { | |
| var controller: ContactDetailTableController! | |
| var presenter: ContactDetailPresenter! | |
| var interactor: ContactDetailInteractor! | |
| required init(data: Any? = nil) { | |
| super.init() | |
| interactor = ContactDetailInteractor() | |
| presenter = ContactDetailPresenter() |
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 HomeRouter: NSObject { | |
| var controller: HomeTableController! | |
| var presenter: HomePresenter! | |
| var interactor: HomeInteractor! | |
| required override init() { | |
| super.init() | |
| interactor = HomeInteractor() | |
| presenter = HomePresenter() |
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 HomePresenter { | |
| var view: HomeViewProtocol! | |
| var interactor: HomeInteractorInputProtocol! | |
| var router: HomeWireframeProtocol! | |
| } | |
| extension HomePresenter: HomePresenterProtocol { | |
| func getContact() { | |
| interactor.getContactFromService() | |
| } |