diff --git a/chat-iOS/Views/MainTabBar/MainTabBarViewController.swift b/chat-iOS/Views/MainTabBar/MainTabBarViewController.swift index ad3a78c..64b5b3e 100644 --- a/chat-iOS/Views/MainTabBar/MainTabBarViewController.swift +++ b/chat-iOS/Views/MainTabBar/MainTabBarViewController.swift @@ -22,9 +22,8 @@ final class MainTabBarViewController: UITabBarController { let userProfileVC = UserProfileViewBuilder.create() let userProfileNavigationController = UINavigationController(rootViewController: userProfileVC) - //TODO:- ここはチャットセレクト画面に遷移すること - let chatsVC = ChatsViewBuilder.create() - let chatsNavigationController = UINavigationController(rootViewController: chatsVC) + let selectChatVC = SelectChatViewBuilder.create() + let selectChatNavigationController = UINavigationController(rootViewController: selectChatVC) //TODO:- iOS12以下の場合の画像を用意すること if #available(iOS 13.0, *) { @@ -35,12 +34,12 @@ final class MainTabBarViewController: UITabBarController { let userProfileTabBarItemSelectedImage = UIImage(systemName: "person.circle.fill") userProfileVC.tabBarItem = UITabBarItem(title: nil, image: userProfileTabBarItemImage, selectedImage: userProfileTabBarItemSelectedImage) - chatsVC.tabBarItem = UITabBarItem(title: nil, image: chatsTabBarItemImage, selectedImage: chatsTabBarItemSelectedImage) + selectChatVC.tabBarItem = UITabBarItem(title: nil, image: chatsTabBarItemImage, selectedImage: chatsTabBarItemSelectedImage) } else { // Fallback on earlier versions } - self.viewControllers = [chatsNavigationController, userProfileNavigationController] + self.viewControllers = [selectChatNavigationController, userProfileNavigationController] } func inject(with presenter: MainTabBarViewPresenterProtocol) { diff --git a/chat-iOS/Views/SelectChat/SelectChatViewController.swift b/chat-iOS/Views/SelectChat/SelectChatViewController.swift index 6ba3297..4418991 100644 --- a/chat-iOS/Views/SelectChat/SelectChatViewController.swift +++ b/chat-iOS/Views/SelectChat/SelectChatViewController.swift @@ -41,7 +41,8 @@ final class SelectChatViewController: UIViewController { extension SelectChatViewController: UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return users.count + //TODO:- userModelを作ったら,`return users.count` に修正すること + return 5 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { @@ -49,6 +50,14 @@ extension SelectChatViewController: UITableViewDelegate, UITableViewDataSource { return cell } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + self.tableView.deselectRow(at: indexPath, animated: true) + + //MARK:- チャットVCに画面遷移する + let chatsVC = ChatsViewBuilder.create() + self.navigationController?.pushViewController(chatsVC, animated: true) + } }