-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update arch #2
base: main
Are you sure you want to change the base?
Update arch #2
Conversation
My bad, didn't specify but please use Stevia in your views/cells as in |
container.register(MainViewController.self) { r in | ||
let controller = MainViewController.instantiate() | ||
controller.viewModel = r ~> MainViewModel.self | ||
|
||
controller.makeDI( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove dependency to nib (use Stevia) so you can inject this via constructor, we won't mutate these anyway.
container.autoregister( | ||
TransactionViewModel.self, | ||
initializer: TransactionViewModel.init | ||
) | ||
container.register(TransactionViewController.self) { r in | ||
let controller = TransactionViewController.instantiate() | ||
controller.viewModel = r ~> TransactionViewModel.self | ||
controller.makeDI( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as MainViewController
@@ -0,0 +1,40 @@ | |||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove author comments(lines 1-7) in all files.
|
||
import Foundation | ||
|
||
enum iConverterError: Error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that iConverterError
acts as namespace so no need to conform to Error
?
iConverter/Pages/Base/Router.swift
Outdated
return nil | ||
} | ||
|
||
func setAndPresentRootController(_ controller: UIViewController, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you copied this from Paysera source code but please fix indentation of parameters (next line)
super.init() | ||
} | ||
|
||
func makeA(transaction: Transaction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makeTransaction(_ transaction: Transaction)
@@ -11,8 +11,9 @@ import NSObject_Rx | |||
|
|||
protocol HistoryDataStoreProtocol { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this should only save and load transactions so no need for updateHistory
and history
, if the user needs to update list, he can just call the loadTransactions
after successful conversion. Same logic as Repository classes in the app wherein the responsibilities are just to read and write realm.
super.init() | ||
} | ||
|
||
func obserHistory(_ history: BehaviorRelay<[Transaction]>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More appropriate would be:
showTransactions(_ transactions: [Transaction]) // or updateTransactions{
vc?.viewModel.transactionsHistory.accept(transactions)
}
so you should remove bind functions in MainViewModel
then in MainInteractor
func loadHistory() {
presenter.showTransactions(historyDataStore.loadTransactions())
}
vc?.viewModel.bind(history: history) | ||
} | ||
|
||
func obserCurrentBalance(_ currentBalance: BehaviorRelay<Balance>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
final class TransactionPresenter: BasePresenter { | ||
weak var vc: TransactionViewController? | ||
|
||
var viewModel: TransactionViewModel? { vc?.viewModel } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd personally won't do this and just directly call vc?.viewModel
but if you'll make it like this, you should declare as private
.withLatestFrom(viewModel.amount) | ||
.withLatestFrom(viewModel.selectedToCurrency) { (amount: $0, to: $1) } | ||
.withLatestFrom(viewModel.selectedFromCurrency) { (amount: $0.amount, from: $1, to: $0.to) } | ||
.subscribe(onNext: { [interactor] t in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please name values properly, probably data
instead of just t
?
@@ -10,7 +10,6 @@ import UIKit | |||
import RxSwift | |||
|
|||
class TransactionViewController: BaseViewController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove all layout-related code here and generate them using Stevia
No description provided.