Skip to content

Commit

Permalink
[fix] 회원가입 후 첫 홈 화면에서 빈 화면이 나오는 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
solbat committed Dec 13, 2022
1 parent d6d0cfa commit aebbced
Showing 1 changed file with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,33 @@ final class HomeViewController: UIViewController, BaseViewController {

override func viewDidLoad() {
super.viewDidLoad()
configure()
title = ""
configureView()
bind()

title = ""
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
viewModel?.input.viewWillAppear.onNext(())
}

private func configure() {
AppDataManager.shared.fetchCapsules()
}

private func configureView() {
view.backgroundColor = .themeBackground

viewModel?.output.featuredCapsuleCellItems
.withUnretained(self)
.bind { owner, capsuleCellItems in
owner.view.subviews.forEach({ $0.removeFromSuperview() })
if capsuleCellItems.isEmpty {
owner.showEmptyView()
} else {
owner.emptyView = nil
owner.showHomeView()
}
}
.disposed(by: disposeBag)

AppDataManager.shared.fetchCapsules()
}

private func showEmptyView() {
Expand Down Expand Up @@ -79,19 +88,6 @@ final class HomeViewController: UIViewController, BaseViewController {
return
}

viewModel.output.featuredCapsuleCellItems
.withUnretained(self)
.bind { owner, capsuleCellItems in
owner.view.subviews.forEach({ $0.removeFromSuperview() })
if capsuleCellItems.isEmpty {
owner.showEmptyView()
} else {
owner.emptyView = nil
owner.showHomeView()
}
}
.disposed(by: disposeBag)

viewModel.output.featuredCapsuleCellItems
.bind(to: homeView.capsuleCollectionView.rx.items) { collectionView, index, element in
guard let cell = collectionView.dequeueReusableCell(
Expand Down

0 comments on commit aebbced

Please sign in to comment.