diff --git a/iOS/traveline/Sources/Feature/TimelineFeature/TimelineScene/VC/TimelineVC.swift b/iOS/traveline/Sources/Feature/TimelineFeature/TimelineScene/VC/TimelineVC.swift index 85b35901..49a258c5 100644 --- a/iOS/traveline/Sources/Feature/TimelineFeature/TimelineScene/VC/TimelineVC.swift +++ b/iOS/traveline/Sources/Feature/TimelineFeature/TimelineScene/VC/TimelineVC.swift @@ -148,6 +148,7 @@ private extension TimelineVC { func setupAttributes() { view.backgroundColor = TLColor.black timelineCollectionView.backgroundView = emptyView + timelineCollectionView.backgroundView?.isHidden = true } func setupLayout() { @@ -202,7 +203,6 @@ private extension TimelineVC { .withUnretained(self) .sink { owner, cardlist in owner.setupData(list: cardlist) - owner.timelineCollectionView.backgroundView?.isHidden = !cardlist.isEmpty } .store(in: &cancellables) @@ -249,6 +249,14 @@ private extension TimelineVC { owner.navigationController?.popViewController(animated: true) } .store(in: &cancellables) + + viewModel.state + .map(\.isEmptyList) + .withUnretained(self) + .sink { owner, isEmptyList in + owner.timelineCollectionView.backgroundView?.isHidden = !isEmptyList + } + .store(in: &cancellables) } } diff --git a/iOS/traveline/Sources/Feature/TimelineFeature/TimelineScene/ViewModel/TimelineViewModel.swift b/iOS/traveline/Sources/Feature/TimelineFeature/TimelineScene/ViewModel/TimelineViewModel.swift index 1bab99be..bc7bf706 100644 --- a/iOS/traveline/Sources/Feature/TimelineFeature/TimelineScene/ViewModel/TimelineViewModel.swift +++ b/iOS/traveline/Sources/Feature/TimelineFeature/TimelineScene/ViewModel/TimelineViewModel.swift @@ -68,6 +68,7 @@ struct TimelineState: BaseState { var isEdit: Bool = false var deleteCompleted: Bool = false var errorMsg: String? + var isEmptyList: Bool = false } final class TimelineViewModel: BaseViewModel { @@ -141,6 +142,7 @@ final class TimelineViewModel: BaseViewModel