Skip to content

Commit 8316d54

Browse files
committed
SelectChat画面に対応したPresenterとModelを追加
1 parent beb7a8b commit 8316d54

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

chat-iOS/Views/SelectChat/SelectChatBuilder.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ struct SelectChatViewBuilder {
1212
guard let selectChatViewController = SelectChatViewController.loadFromStoryboard() as? SelectChatViewController else {
1313
fatalError("fatal: Failed to initialize the ChatsViewController")
1414
}
15+
let model = SelectChatModel()
16+
let presenter = SelectChatViewPresenter(model: model)
17+
selectChatViewController.inject(with: presenter)
1518
return selectChatViewController
1619
}
1720
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// SelectChatModel.swift
3+
// chat-iOS
4+
//
5+
// Created by 松木周 on 2020/07/15.
6+
//
7+
8+
import Foundation
9+
10+
protocol SelectChatModelProtocol {
11+
var presenter: SelectChatModelOutput! { get set }
12+
}
13+
14+
protocol SelectChatModelOutput: class {
15+
}
16+
17+
final class SelectChatModel: SelectChatModelProtocol {
18+
19+
weak var presenter: SelectChatModelOutput!
20+
}

chat-iOS/Views/SelectChat/SelectChatViewController.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ class SelectChatViewController: UIViewController {
1212
@IBOutlet weak var selectChatTableView: UITableView!
1313

1414
private let reuseCellId = "SelectChatTableViewCell"
15+
private var presenter: SelectChatViewPresenterProtocol!
1516

1617
override func viewDidLoad() {
1718
super.viewDidLoad()
1819

1920
setupSelectChatTableView()
2021
}
2122

23+
func inject(with presenter: SelectChatViewPresenterProtocol) {
24+
25+
self.presenter = presenter
26+
self.presenter.view = self
27+
28+
}
29+
2230
func setupSelectChatTableView() {
2331

2432
self.selectChatTableView.delegate = self
@@ -46,3 +54,7 @@ extension SelectChatViewController: UITableViewDataSource {
4654
}
4755

4856
}
57+
58+
extension SelectChatViewController: SelectChatViewPresenterOutput {
59+
60+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// SelectChatViewPresenter.swift
3+
// chat-iOS
4+
//
5+
// Created by 松木周 on 2020/07/15.
6+
//
7+
8+
import Foundation
9+
10+
protocol SelectChatViewPresenterProtocol {
11+
var view: SelectChatViewPresenterOutput! { get set }
12+
}
13+
14+
protocol SelectChatViewPresenterOutput: class {
15+
}
16+
17+
final class SelectChatViewPresenter: SelectChatViewPresenterProtocol, SelectChatModelOutput {
18+
19+
weak var view: SelectChatViewPresenterOutput!
20+
private var model: SelectChatModelProtocol
21+
22+
init(model: SelectChatModelProtocol) {
23+
self.model = model
24+
}
25+
26+
}

0 commit comments

Comments
 (0)