Skip to content

Commit beb7a8b

Browse files
committed
SelectChat画面を追加
1 parent 9c863ae commit beb7a8b

File tree

6 files changed

+217
-5
lines changed

6 files changed

+217
-5
lines changed

chat-iOS/Views/MainTabBar/MainTabBarViewController.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ final class MainTabBarViewController: UITabBarController {
2121

2222
let userProfileVC = UserProfileViewBuilder.create()
2323
let userProfileNavigationController = UINavigationController(rootViewController: userProfileVC)
24-
25-
//TODO:- ここはチャットセレクト画面に遷移すること
26-
let chatsVC = ChatsViewBuilder.create()
27-
let chatsNavigationController = UINavigationController(rootViewController: chatsVC)
24+
25+
let selectChatVC = SelectChatViewBuilder.create()
26+
let chatsNavigationController = UINavigationController(rootViewController: selectChatVC)
2827

2928
//TODO:- iOS12以下の場合の画像を用意すること
3029
if #available(iOS 13.0, *) {
@@ -35,7 +34,7 @@ final class MainTabBarViewController: UITabBarController {
3534
let userProfileTabBarItemSelectedImage = UIImage(systemName: "person.circle.fill")
3635

3736
userProfileVC.tabBarItem = UITabBarItem(title: nil, image: userProfileTabBarItemImage, selectedImage: userProfileTabBarItemSelectedImage)
38-
chatsVC.tabBarItem = UITabBarItem(title: nil, image: chatsTabBarItemImage, selectedImage: chatsTabBarItemSelectedImage)
37+
selectChatVC.tabBarItem = UITabBarItem(title: nil, image: chatsTabBarItemImage, selectedImage: chatsTabBarItemSelectedImage)
3938
} else {
4039
// Fallback on earlier versions
4140
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// SelectChatBuilder.swift
3+
// chat-iOS
4+
//
5+
// Created by 松木周 on 2020/07/15.
6+
//
7+
8+
import UIKit
9+
10+
struct SelectChatViewBuilder {
11+
static func create() -> UIViewController {
12+
guard let selectChatViewController = SelectChatViewController.loadFromStoryboard() as? SelectChatViewController else {
13+
fatalError("fatal: Failed to initialize the ChatsViewController")
14+
}
15+
return selectChatViewController
16+
}
17+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// SelectChatTableViewCell.swift
3+
// chat-iOS
4+
//
5+
// Created by 松木周 on 2020/07/15.
6+
//
7+
8+
import UIKit
9+
10+
class SelectChatTableViewCell: UITableViewCell {
11+
12+
@IBOutlet weak var userProfileImageView: UIImageView!
13+
@IBOutlet weak var userNameLabel: UILabel!
14+
@IBOutlet weak var lastMessageLabel: UILabel!
15+
@IBOutlet weak var lastMessageTimeLabel: UILabel!
16+
17+
override func awakeFromNib() {
18+
super.awakeFromNib()
19+
// Initialization code
20+
}
21+
22+
override func setSelected(_ selected: Bool, animated: Bool) {
23+
super.setSelected(selected, animated: animated)
24+
25+
// Configure the view for the selected state
26+
}
27+
28+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
7+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
8+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9+
</dependencies>
10+
<objects>
11+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
12+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
13+
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="SelectChatTableViewCell" rowHeight="80" id="KGk-i7-Jjw" customClass="SelectChatTableViewCell" customModule="chat_iOS" customModuleProvider="target">
14+
<rect key="frame" x="0.0" y="0.0" width="414" height="80"/>
15+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
16+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
17+
<rect key="frame" x="0.0" y="0.0" width="414" height="80"/>
18+
<autoresizingMask key="autoresizingMask"/>
19+
<subviews>
20+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="2gC-Cj-Q7U">
21+
<rect key="frame" x="10" y="10" width="60" height="60"/>
22+
<constraints>
23+
<constraint firstAttribute="width" secondItem="2gC-Cj-Q7U" secondAttribute="height" multiplier="1:1" id="EkN-nk-5ft"/>
24+
</constraints>
25+
</imageView>
26+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RUf-a9-7FA">
27+
<rect key="frame" x="80" y="10" width="254" height="20"/>
28+
<constraints>
29+
<constraint firstAttribute="height" constant="20" id="VfV-5S-hH0"/>
30+
</constraints>
31+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
32+
<nil key="textColor"/>
33+
<nil key="highlightedColor"/>
34+
</label>
35+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s36-dq-cAX">
36+
<rect key="frame" x="80" y="35" width="254" height="35"/>
37+
<constraints>
38+
<constraint firstAttribute="height" constant="35" id="TKY-oo-UjD"/>
39+
</constraints>
40+
<fontDescription key="fontDescription" type="system" pointSize="14"/>
41+
<nil key="textColor"/>
42+
<nil key="highlightedColor"/>
43+
</label>
44+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fSn-KO-GXm">
45+
<rect key="frame" x="361" y="29.5" width="43" height="21.5"/>
46+
<constraints>
47+
<constraint firstAttribute="width" secondItem="fSn-KO-GXm" secondAttribute="height" multiplier="2:1" id="UvM-kF-J7e"/>
48+
</constraints>
49+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
50+
<nil key="textColor"/>
51+
<nil key="highlightedColor"/>
52+
</label>
53+
</subviews>
54+
<constraints>
55+
<constraint firstItem="2gC-Cj-Q7U" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="10" id="0Mg-FZ-GXl"/>
56+
<constraint firstItem="2gC-Cj-Q7U" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="Tcd-3b-Och"/>
57+
<constraint firstAttribute="trailing" secondItem="RUf-a9-7FA" secondAttribute="trailing" constant="80" id="aBP-vW-5se"/>
58+
<constraint firstItem="RUf-a9-7FA" firstAttribute="leading" secondItem="2gC-Cj-Q7U" secondAttribute="trailing" constant="10" id="cK4-ly-L8d"/>
59+
<constraint firstItem="fSn-KO-GXm" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="frq-JC-iPM"/>
60+
<constraint firstItem="RUf-a9-7FA" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="glk-o7-RvN"/>
61+
<constraint firstAttribute="trailing" secondItem="s36-dq-cAX" secondAttribute="trailing" constant="80" id="lMx-4U-eO2"/>
62+
<constraint firstItem="2gC-Cj-Q7U" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="sDh-wI-Gju"/>
63+
<constraint firstItem="s36-dq-cAX" firstAttribute="leading" secondItem="2gC-Cj-Q7U" secondAttribute="trailing" constant="10" id="sb8-iH-huW"/>
64+
<constraint firstItem="s36-dq-cAX" firstAttribute="top" secondItem="RUf-a9-7FA" secondAttribute="bottom" constant="5" id="ugB-A4-Qaj"/>
65+
<constraint firstAttribute="trailing" secondItem="fSn-KO-GXm" secondAttribute="trailing" constant="10" id="zDm-rR-7x7"/>
66+
</constraints>
67+
</tableViewCellContentView>
68+
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
69+
<connections>
70+
<outlet property="lastMessageLabel" destination="s36-dq-cAX" id="Dse-v4-Rar"/>
71+
<outlet property="lastMessageTimeLabel" destination="fSn-KO-GXm" id="7Ln-rM-fr1"/>
72+
<outlet property="userNameLabel" destination="RUf-a9-7FA" id="NKh-84-hOF"/>
73+
<outlet property="userProfileImageView" destination="2gC-Cj-Q7U" id="htG-bi-fL3"/>
74+
</connections>
75+
<point key="canvasLocation" x="137.68115942028987" y="154.01785714285714"/>
76+
</tableViewCell>
77+
</objects>
78+
</document>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// SelectChatViewController.swift
3+
// chat-iOS
4+
//
5+
// Created by 松木周 on 2020/07/15.
6+
//
7+
8+
import UIKit
9+
10+
class SelectChatViewController: UIViewController {
11+
12+
@IBOutlet weak var selectChatTableView: UITableView!
13+
14+
private let reuseCellId = "SelectChatTableViewCell"
15+
16+
override func viewDidLoad() {
17+
super.viewDidLoad()
18+
19+
setupSelectChatTableView()
20+
}
21+
22+
func setupSelectChatTableView() {
23+
24+
self.selectChatTableView.delegate = self
25+
self.selectChatTableView.dataSource = self
26+
self.selectChatTableView.register(UINib(nibName: reuseCellId, bundle: nil), forCellReuseIdentifier: reuseCellId)
27+
self.selectChatTableView.tableFooterView = UIView()
28+
29+
}
30+
31+
}
32+
33+
extension SelectChatViewController: UITableViewDelegate {
34+
}
35+
36+
extension SelectChatViewController: UITableViewDataSource {
37+
38+
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
39+
return 10
40+
}
41+
42+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
43+
let cell = tableView.dequeueReusableCell(withIdentifier: reuseCellId) as! SelectChatTableViewCell
44+
45+
return cell
46+
}
47+
48+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="eal-jp-sYP">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
7+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
8+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9+
</dependencies>
10+
<scenes>
11+
<!--Select Chat View Controller-->
12+
<scene sceneID="V40-qS-iLb">
13+
<objects>
14+
<viewController id="eal-jp-sYP" customClass="SelectChatViewController" customModule="chat_iOS" customModuleProvider="target" sceneMemberID="viewController">
15+
<view key="view" contentMode="scaleToFill" id="gOO-pQ-6oA">
16+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
17+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18+
<subviews>
19+
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="80" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="3cg-eT-4Ga">
20+
<rect key="frame" x="0.0" y="44" width="414" height="818"/>
21+
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
22+
</tableView>
23+
</subviews>
24+
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
25+
<constraints>
26+
<constraint firstItem="3cg-eT-4Ga" firstAttribute="bottom" secondItem="ieU-cA-hYd" secondAttribute="bottom" id="1Xa-gD-ava"/>
27+
<constraint firstItem="3cg-eT-4Ga" firstAttribute="leading" secondItem="ieU-cA-hYd" secondAttribute="leading" id="Cfd-vA-O1Y"/>
28+
<constraint firstItem="3cg-eT-4Ga" firstAttribute="top" secondItem="ieU-cA-hYd" secondAttribute="top" id="LdO-Hr-wOY"/>
29+
<constraint firstItem="3cg-eT-4Ga" firstAttribute="trailing" secondItem="ieU-cA-hYd" secondAttribute="trailing" id="UUJ-J9-BIu"/>
30+
</constraints>
31+
<viewLayoutGuide key="safeArea" id="ieU-cA-hYd"/>
32+
</view>
33+
<connections>
34+
<outlet property="selectChatTableView" destination="3cg-eT-4Ga" id="XiG-gb-QX6"/>
35+
</connections>
36+
</viewController>
37+
<placeholder placeholderIdentifier="IBFirstResponder" id="H0G-jw-nxa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
38+
</objects>
39+
<point key="canvasLocation" x="308.69565217391306" y="59.598214285714285"/>
40+
</scene>
41+
</scenes>
42+
</document>

0 commit comments

Comments
 (0)