Skip to content

Commit

Permalink
[Feat] sopt-makers#12 - ModuleFactory에 SignUpVC 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
lsj8706 committed Nov 28, 2022
1 parent d187669 commit b5c6eb4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
import Foundation

public protocol ModuleFactoryInterface {

func makeSignUpVC() -> SignUpVC
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Core
public class SignUpVC: UIViewController {

// MARK: - Properties

public var factory: ModuleFactoryInterface!
public var viewModel: SignUpViewModel!
private var cancelBag = CancelBag()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

window = UIWindow(frame: scene.coordinateSpace.bounds)
window?.windowScene = scene
// let vc = UIViewController()
let vc = TestVC()
// vc.view.backgroundColor = .gray
window?.rootViewController = UINavigationController(rootViewController: vc)
let rootVC = ModuleFactory.shared.makeSignUpVC()
window?.rootViewController = UINavigationController(rootViewController: rootVC)
window?.makeKeyAndVisible()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,18 @@ import Data
public class ModuleFactory {
static let shared = ModuleFactory()
private init() { }

lazy var authService = DefaultAuthService()
}

extension ModuleFactory: ModuleFactoryInterface {

public func makeSignUpVC() -> Presentation.SignUpVC {
let repository = SignUpRepository(service: authService)
let useCase = DefaultSignUpUseCase(repository: repository)
let viewModel = SignUpViewModel(useCase: useCase)
let signUpVC = SignUpVC()
signUpVC.factory = self
signUpVC.viewModel = viewModel
return signUpVC
}
}

0 comments on commit b5c6eb4

Please sign in to comment.