Skip to content
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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Update arch #2

wants to merge 8 commits into from

Conversation

AramSemerjyan
Copy link
Owner

No description provided.

@softwaresaiyajin
Copy link

My bad, didn't specify but please use Stevia in your views/cells as in ShopTableViewCell/ShopView

container.register(MainViewController.self) { r in
let controller = MainViewController.instantiate()
controller.viewModel = r ~> MainViewModel.self

controller.makeDI(

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(

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 @@
//

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 {

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 ?

return nil
}

func setAndPresentRootController(_ controller: UIViewController,

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) {

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 {
Copy link

@softwaresaiyajin softwaresaiyajin Apr 25, 2022

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]>) {
Copy link

@softwaresaiyajin softwaresaiyajin Apr 25, 2022

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>) {

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 }

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

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 {

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants