Levan Karanadze

Apr 10, 2021 20:58
but is it good solution?
Apr 10, 2021 20:58
I know that it will give me the result
Apr 10, 2021 20:58
I am just not sure in asyncAfter
Apr 10, 2021 20:57
Let's forget details of my project. it complicates the question
Apr 10, 2021 20:55
and for usecase to
Apr 10, 2021 20:55
I have mock for router also
Apr 10, 2021 20:55
class MockLogiView: LoginView {

var messageIsShown = false
var loaderShown = false

func showMessage(_ messsage: Message) {
messageIsShown = true
}

func showLoader() {
loaderShown = true
}

func hideLoader() {
loaderShown = false
}
}
Apr 10, 2021 20:55
I have Mock classes
Apr 10, 2021 20:53
ant that's controller
Apr 10, 2021 20:53
import UIKit

class LoginViewController: BaseViewController {

var presenter: LoginPresenter!

private let configurator = LoginConfiguratorImpl.init()

override func viewDidLoad() {
super.viewDidLoad()
configurator.configure(for: self)
}

@IBAction private func didTapLoginn(_ sender: Any) {
presenter.didTapLogin(userName: "bal", password: "bla")
}
}

extension LoginViewController: LoginView {

}
Apr 10, 2021 20:52
thats my presenter
Apr 10, 2021 20:52
protocol LoginPresenter {
func didTapLogin(userName: String?, password: String?)
func didTapRegister()
func didTapRecoverPassword()
}

protocol LoginView: View {

}

class LoginPresenterImpl: LoginPresenter {

private weak var view: LoginView?
private let router: LoginRouter
private let loginUseCase: LoginUseCase

init(view: LoginView, router: LoginRouter, loginUseCase: LoginUseCase) {
self.view = view
self.router = router
self.loginUseCase = loginUseCase
}

func didTapLogin(userName: String?, password: String?) {
Apr 10, 2021 20:51
I'm using MVP+Clean architecture. didTapLogin is a function in Presenter. Presenter should make call using useCase and also handle the response.
Apr 10, 2021 20:51
I don't have callback, thus I can't fulfill expectation.
Apr 10, 2021 20:51
I'm writing unit tests. I want to test something like this: sut.didTapLogin(userName: "bla", password: "bla") XCTAssertTrue(<invalid username is handled>)
 

iOS Dev

Here you can discuss problems and share new hacks about code
Aug 9, 2019 13:37
hi