Skip to content

Commit

Permalink
Merge pull request #48 from boostcampwm-2022/feature/ConnectQuestLayer
Browse files Browse the repository at this point in the history
Feature/connect quest layer
  • Loading branch information
jinwoong16 committed Nov 24, 2022
2 parents dc6363b + b484652 commit 60fbe44
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,26 @@ import UIKit

final class HomeSceneDIContainer {

lazy var questsStorage: QuestsStorage = RealmQuestsStorage()

// MARK: - Repositories
func makeQuestsRepository() -> QuestsRepository {
return DefaultQuestsRepository(persistentStorage: questsStorage)
}

// MARK: - Use Cases
func makeQuestUseCase() -> QuestUseCase {
return DefaultQuestUseCase(questsRepository: makeQuestsRepository())
}

// MARK: - View Models
func makeQuestViewModel() -> QuestViewModel {
return QuestViewModel(questUseCase: makeQuestUseCase())
}

// MARK: - View Controller
func makeHomeViewController() -> HomeViewController {
return HomeViewController.create()
return HomeViewController.create(with: makeQuestViewModel())
}

// MARK: - Flow
Expand Down
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 60fbe44

Please sign in to comment.