Skip to content

Commit

Permalink
Merge branch 'team05-iOS-dev' of https://github.com/pbg0205/baseball
Browse files Browse the repository at this point in the history
…into feature/Feedback
  • Loading branch information
zzisun committed May 11, 2021
2 parents acbdaa3 + b3f45f8 commit a7e92c0
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class HomeViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
bindCollectionView()
mainCollectionView.delegate = self
setupCollectionViewDelegate()
}

private func bindCollectionView() {
Expand All @@ -21,11 +21,15 @@ class HomeViewController: UIViewController {
cell.configureCell(game: game)
}.disposed(by: disposeBag)
}
}

extension HomeViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let tapBarVC = (storyboard?.instantiateViewController(identifier: "TabBar"))!
present(tapBarVC, animated: true, completion: nil)

private func setupCollectionViewDelegate() {
mainCollectionView.rx.itemSelected
.subscribe(onNext: { [weak self] indexPath in
let tabBarVC = self?.storyboard?.instantiateViewController(identifier: "TabBar")
self?.present(tabBarVC!, animated: true, completion: nil)
}, onError: { error in
print(error.localizedDescription)
})
.disposed(by: disposeBag)
}
}

0 comments on commit a7e92c0

Please sign in to comment.