Skip to content

Commit

Permalink
[Fix] sopt-makers#80 - 미션리스트에서 다른 사람 목록이 보이도록 하기
Browse files Browse the repository at this point in the history
fetchTypeSelected를 dropFirst함
  • Loading branch information
L-j-h-c committed Jan 7, 2023
1 parent 63d4e49 commit 8eb36c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ extension MissionListVC {

private func bindViewModels() {

let input = MissionListViewModel.Input(viewDidLoad: Driver.just(()),
viewWillAppear: viewWillAppear.asDriver(),
let input = MissionListViewModel.Input(viewWillAppear: viewWillAppear.asDriver(),
missionTypeSelected: missionTypeMenuSelected.asDriver())

let output = self.viewModel.transform(from: input, cancelBag: self.cancelBag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ import Domain
public enum MissionListSceneType {
case `default`
case ranking(userName: String, sentence: String, userId: Int)

var isRankingView: Bool {
switch self {
case .default: return false
case .ranking: return true
}
}
}

public class MissionListViewModel: ViewModelType {
Expand All @@ -27,7 +34,6 @@ public class MissionListViewModel: ViewModelType {
// MARK: - Inputs

public struct Input {
let viewDidLoad: Driver<Void>
let viewWillAppear: Driver<Void>
let missionTypeSelected: Driver<MissionListFetchType>
}
Expand All @@ -51,20 +57,14 @@ extension MissionListViewModel {
let output = Output()
self.bindOutput(output: output, cancelBag: cancelBag)

input.viewDidLoad
.withUnretained(self)
.sink { owner, _ in
owner.fetchMissionList()
}.store(in: cancelBag)

input.viewWillAppear
.dropFirst()
.withUnretained(self)
.sink { owner, _ in
owner.fetchMissionList()
}.store(in: cancelBag)

input.missionTypeSelected
.dropFirst()
.withUnretained(self)
.sink { owner, fetchType in
owner.useCase.fetchMissionList(type: fetchType)
Expand Down

0 comments on commit 8eb36c2

Please sign in to comment.