Skip to content

Commit

Permalink
[refactor] HomeViewController에서 하위 view에 viewmodel 배치
Browse files Browse the repository at this point in the history
- Home View가 .create(with:)로 받아온 view model을 quest view와 연결
  • Loading branch information
jinwoong16 committed Nov 23, 2022
1 parent 4afe662 commit b484652
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ final class HomeViewController: UIViewController {

private lazy var questView: QuestView = {
let questView = QuestView()
// questView.setup(with: QuestViewModel())

return questView
}()
Expand All @@ -33,9 +32,11 @@ final class HomeViewController: UIViewController {
}()

// MARK: - Life Cycle
// static func create(with viewModel: HomeViewModel)
static func create() -> HomeViewController {
return HomeViewController()
static func create(with viewModel: QuestViewModel) -> HomeViewController {
let vc = HomeViewController()
vc.setup(questViewModel: viewModel)

return vc
}

override func viewDidLoad() {
Expand Down Expand Up @@ -69,4 +70,8 @@ final class HomeViewController: UIViewController {
})
.disposed(by: disposableBag)
}

private func setup(questViewModel: QuestViewModel) {
questView.setup(with: questViewModel)
}
}

0 comments on commit b484652

Please sign in to comment.