Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions chat-iOS/Views/SelectChat/SelectChatModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// SelectChatModel.swift
// chat-iOS
//
// Created by 松木周 on 2020/06/21.
//

protocol SelectChatModelProtocol {
var presenter: SelectChatModelOutput! { get set }
}

protocol SelectChatModelOutput {

}

final class SelectChatModel: SelectChatModelProtocol {
var presenter: SelectChatModelOutput!
}
29 changes: 29 additions & 0 deletions chat-iOS/Views/SelectChat/SelectChatTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// SelectChatTableViewCell.swift
// chat-iOS
//
// Created by 松木周 on 2020/06/21.
//

import UIKit

class SelectChatTableViewCell: UITableViewCell {

@IBOutlet weak var userImageView: UIImageView!
@IBOutlet weak var userNameLabel: UILabel!
@IBOutlet weak var messageLabel: UILabel!
@IBOutlet weak var lastMessageTimeLabel: UILabel!


override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

// Configure the view for the selected state
}

}
79 changes: 79 additions & 0 deletions chat-iOS/Views/SelectChat/SelectChatTableViewCell.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="SelectChatTableViewCell" rowHeight="80" id="KGk-i7-Jjw" customClass="SelectChatTableViewCell" customModule="chat_iOS" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="414" height="80"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="414" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="mFr-lQ-oit">
<rect key="frame" x="10" y="10" width="60" height="60"/>
<constraints>
<constraint firstAttribute="height" constant="60" id="9HA-4N-5lc"/>
<constraint firstAttribute="width" constant="60" id="to4-Da-dJe"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Sf-kV-Dj7">
<rect key="frame" x="80" y="10" width="259" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="LYV-dQ-Tt6"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="time" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HfR-Vu-L0K">
<rect key="frame" x="364" y="30" width="40" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="fVM-Xi-Xwf"/>
<constraint firstAttribute="height" constant="20" id="fyF-KH-8lk"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Afi-99-RBW">
<rect key="frame" x="80" y="40" width="274" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="s2U-LB-VGO"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="Afi-99-RBW" firstAttribute="top" secondItem="1Sf-kV-Dj7" secondAttribute="bottom" constant="10" id="AYx-g7-odh"/>
<constraint firstItem="HfR-Vu-L0K" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="BE9-dj-f9y"/>
<constraint firstItem="Afi-99-RBW" firstAttribute="leading" secondItem="mFr-lQ-oit" secondAttribute="trailing" constant="10" id="M8D-5u-fOh"/>
<constraint firstItem="HfR-Vu-L0K" firstAttribute="leading" secondItem="Afi-99-RBW" secondAttribute="trailing" constant="10" id="Rtc-fb-L9C"/>
<constraint firstItem="1Sf-kV-Dj7" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="T71-a1-Fve"/>
<constraint firstItem="mFr-lQ-oit" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="10" id="UFa-N5-xib"/>
<constraint firstAttribute="trailing" secondItem="1Sf-kV-Dj7" secondAttribute="trailing" constant="75" id="XVQ-mg-NTZ"/>
<constraint firstAttribute="trailing" secondItem="HfR-Vu-L0K" secondAttribute="trailing" constant="10" id="Y0t-Cd-tf3"/>
<constraint firstItem="1Sf-kV-Dj7" firstAttribute="leading" secondItem="mFr-lQ-oit" secondAttribute="trailing" constant="10" id="gna-Vd-dY7"/>
<constraint firstItem="mFr-lQ-oit" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="yct-Nd-Eek"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="lastMessageTimeLabel" destination="HfR-Vu-L0K" id="Bpg-1u-qpZ"/>
<outlet property="messageLabel" destination="Afi-99-RBW" id="eJi-j6-FJN"/>
<outlet property="userImageView" destination="mFr-lQ-oit" id="SbW-mE-bK9"/>
<outlet property="userNameLabel" destination="1Sf-kV-Dj7" id="oem-7m-WMu"/>
</connections>
<point key="canvasLocation" x="137.68115942028987" y="119.86607142857142"/>
</tableViewCell>
</objects>
</document>
20 changes: 20 additions & 0 deletions chat-iOS/Views/SelectChat/SelectChatViewBuilder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// SelectChatViewBuilder.swift
// chat-iOS
//
// Created by 松木周 on 2020/06/21.
//

import UIKit

struct SelectChatViewBuilder {
static func create() -> UIViewController {
guard let selectChatViewController = SelectChatViewController.loadFromStoryboard() as? SelectChatViewController else {
fatalError("fatal: Failed to initialize the SampleViewController")
}
let model = SelectChatModel()
let presenter = SelectChatViewPresenter(model: model)
selectChatViewController.inject(with: presenter)
return selectChatViewController
}
}
58 changes: 58 additions & 0 deletions chat-iOS/Views/SelectChat/SelectChatViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// SelectChatViewController.swift
// chat-iOS
//
// Created by 松木周 on 2020/06/21.
//

import UIKit

final class SelectChatViewController: UIViewController {

@IBOutlet private weak var tableView: UITableView!

typealias cell = SelectChatTableViewCell
private let cellClassName = NSStringFromClass(cell.self).components(separatedBy: ".").last!
private var users = [Any]()
private var presenter: SelectChatViewPresenterProtocol!

override func viewDidLoad() {
super.viewDidLoad()

setup()
}

func inject(with presenter: SelectChatViewPresenterProtocol) {
self.presenter = presenter
self.presenter.view = self
}


private func setup() {

tableView.register(UINib(nibName: cellClassName, bundle: nil), forCellReuseIdentifier: cellClassName)
tableView.delegate = self
tableView.dataSource = self
tableView.tableFooterView = UIView()

}

}

extension SelectChatViewController: UITableViewDelegate, UITableViewDataSource {

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return users.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: cellClassName) as! cell

return cell
}

}

extension SelectChatViewController: SelectChatViewPresenterOutput {

}
23 changes: 23 additions & 0 deletions chat-iOS/Views/SelectChat/SelectChatViewPresenter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// SelectChatViewPresenter.swift
// chat-iOS
//
// Created by 松木周 on 2020/06/21.
//

protocol SelectChatViewPresenterProtocol {
var view: SelectChatViewPresenterOutput! { get set }
}

protocol SelectChatViewPresenterOutput {

}

final class SelectChatViewPresenter: SelectChatViewPresenterProtocol, SelectChatModelOutput {
var view: SelectChatViewPresenterOutput!
private var model: SelectChatModelProtocol

init(model: SelectChatModelProtocol) {
self.model = model
}
}
42 changes: 42 additions & 0 deletions chat-iOS/Views/Storyboards/SelectChat.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="Tmk-1E-NQJ">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Select Chat View Controller-->
<scene sceneID="lr0-dZ-gy6">
<objects>
<viewController id="Tmk-1E-NQJ" customClass="SelectChatViewController" customModule="chat_iOS" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="23B-OE-cCO">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="80" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="yKT-1f-ySa">
<rect key="frame" x="0.0" y="44" width="414" height="818"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
</tableView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="z1I-4v-lWg" firstAttribute="trailing" secondItem="yKT-1f-ySa" secondAttribute="trailing" id="2JC-mK-9gL"/>
<constraint firstItem="z1I-4v-lWg" firstAttribute="bottom" secondItem="yKT-1f-ySa" secondAttribute="bottom" id="7sk-Xy-3OT"/>
<constraint firstItem="yKT-1f-ySa" firstAttribute="leading" secondItem="z1I-4v-lWg" secondAttribute="leading" id="dBo-cV-8Wk"/>
<constraint firstItem="yKT-1f-ySa" firstAttribute="top" secondItem="z1I-4v-lWg" secondAttribute="top" id="heY-Sy-utm"/>
</constraints>
<viewLayoutGuide key="safeArea" id="z1I-4v-lWg"/>
</view>
<connections>
<outlet property="tableView" destination="yKT-1f-ySa" id="2kQ-qW-mNi"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="6Eo-ps-NRD" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="142" y="202"/>
</scene>
</scenes>
</document>