git.iko.soy/dashared/GDproject
on master help sign in
Message flow is added. You can see list of dialogs, choose a person to write message to. Needs a lot of modification because everything with my [] for now. Need to add messages in dialog.
commitb47de10a3e119b10f4af134a721045628b7cae94 authorDarya Rednikina <rednikina.com@yandex.ru> dateWed 1 May 2019, 16:19 (7 years ago) parent2c1cb56
7 files changed+349−17
GDproject.xcodeproj/project.pbxproj+8 GDproject/Base.lproj/Main.storyboard+89−1 GDproject/Constants.swift+5−1 GDproject/Controller/Coordinators/MessagesCoordinator.swift+13 GDproject/Controller/Messages/DialogViewController.swift+90 GDproject/Controller/Messages/MessagesViewController.swift+38−15 GDproject/Controller/Messages/PeopleToWriteViewController.swift+106
GDproject.xcodeproj/project.pbxproj+8
@@ -21,6 +21,8 @@
2121 1291BE3622218DBF009D3F23 /* LogInCoordinator1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1291BE3522218DBF009D3F23 /* LogInCoordinator1.swift */; };
2222 129320042279B4270035C7B3 /* MessagesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 129320032279B4270035C7B3 /* MessagesViewController.swift */; };
2323 129320072279B5690035C7B3 /* MessagesCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 129320062279B5690035C7B3 /* MessagesCoordinator.swift */; };
24+ 129320092279C3B50035C7B3 /* PeopleToWriteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 129320082279C3B50035C7B3 /* PeopleToWriteViewController.swift */; };
25+ 1293200B2279D02D0035C7B3 /* DialogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1293200A2279D02D0035C7B3 /* DialogViewController.swift */; };
2426 12BA4B9B224101A400DF93D7 /* ApplicationCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12BA4B9A224101A400DF93D7 /* ApplicationCoordinator.swift */; };
2527 12BA4B9D224101E700DF93D7 /* BaseCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12BA4B9C224101E700DF93D7 /* BaseCoordinator.swift */; };
2628 12BA4B9F224102B700DF93D7 /* LogInCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12BA4B9E224102B700DF93D7 /* LogInCoordinator.swift */; };
@@ -105,6 +107,8 @@
105107 1291BE3522218DBF009D3F23 /* LogInCoordinator1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInCoordinator1.swift; sourceTree = "<group>"; };
106108 129320032279B4270035C7B3 /* MessagesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; };
107109 129320062279B5690035C7B3 /* MessagesCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesCoordinator.swift; sourceTree = "<group>"; };
110+ 129320082279C3B50035C7B3 /* PeopleToWriteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PeopleToWriteViewController.swift; path = GDproject/Controller/Messages/PeopleToWriteViewController.swift; sourceTree = SOURCE_ROOT; };
111+ 1293200A2279D02D0035C7B3 /* DialogViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = DialogViewController.swift; path = GDproject/Controller/Messages/DialogViewController.swift; sourceTree = SOURCE_ROOT; };
108112 12BA4B9A224101A400DF93D7 /* ApplicationCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationCoordinator.swift; sourceTree = "<group>"; };
109113 12BA4B9C224101E700DF93D7 /* BaseCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseCoordinator.swift; sourceTree = "<group>"; };
110114 12BA4B9E224102B700DF93D7 /* LogInCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInCoordinator.swift; sourceTree = "<group>"; };
@@ -204,6 +208,8 @@
204208 129320052279B4300035C7B3 /* Messages */ = {
205209 isa = PBXGroup;
206210 children = (
211+ 129320082279C3B50035C7B3 /* PeopleToWriteViewController.swift */,
212+ 1293200A2279D02D0035C7B3 /* DialogViewController.swift */,
207213 129320032279B4270035C7B3 /* MessagesViewController.swift */,
208214 );
209215 path = Messages;
@@ -396,6 +402,7 @@
396402 12E36DB72214400A006FCDD7 /* Post.swift in Sources */,
397403 12DB7FDF221877160096878E /* InviteViewController.swift in Sources */,
398404 121A8972226B1EAC005EE599 /* AnonimousChannelController.swift in Sources */,
405+ 1293200B2279D02D0035C7B3 /* DialogViewController.swift in Sources */,
399406 12E36DCA22144635006FCDD7 /* NewPostViewController.swift in Sources */,
400407 12E36D9E221424EA006FCDD7 /* NewsController.swift in Sources */,
401408 12E36DCC22144725006FCDD7 /* PostViewCell.swift in Sources */,
@@ -403,6 +410,7 @@
403410 125BD57F22171D73008A3575 /* Extentions.swift in Sources */,
404411 12D7D133221C321600B35452 /* ChannelListController.swift in Sources */,
405412 1291BE342221569B009D3F23 /* TabbarCoordinator.swift in Sources */,
413+ 129320092279C3B50035C7B3 /* PeopleToWriteViewController.swift in Sources */,
406414 12BA4B9B224101A400DF93D7 /* ApplicationCoordinator.swift in Sources */,
407415 1291BE2D2221312D009D3F23 /* ChannelsCoordinator.swift in Sources */,
408416 12E36DD122148122006FCDD7 /* FullPostController.swift in Sources */,
GDproject/Base.lproj/Main.storyboard+89−1
@@ -439,12 +439,28 @@
439439 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
440440 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
441441 <prototypes>
442− <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="67C-fT-WEV">
442+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="MessagesCell" textLabel="9br-gb-mg8" detailTextLabel="Jxd-We-VyC" style="IBUITableViewCellStyleSubtitle" id="67C-fT-WEV">
443443 <rect key="frame" x="0.0" y="28" width="375" height="44"/>
444444 <autoresizingMask key="autoresizingMask"/>
445445 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="67C-fT-WEV" id="O3b-Xv-UNk">
446446 <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
447447 <autoresizingMask key="autoresizingMask"/>
448+ <subviews>
449+ <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="9br-gb-mg8">
450+ <rect key="frame" x="16" y="5" width="33.5" height="20.5"/>
451+ <autoresizingMask key="autoresizingMask"/>
452+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
453+ <nil key="textColor"/>
454+ <nil key="highlightedColor"/>
455+ </label>
456+ <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Jxd-We-VyC">
457+ <rect key="frame" x="16" y="25.5" width="33" height="14.5"/>
458+ <autoresizingMask key="autoresizingMask"/>
459+ <fontDescription key="fontDescription" type="system" pointSize="12"/>
460+ <nil key="textColor"/>
461+ <nil key="highlightedColor"/>
462+ </label>
463+ </subviews>
448464 </tableViewCellContentView>
449465 </tableViewCell>
450466 </prototypes>
@@ -458,6 +474,78 @@
458474 </objects>
459475 <point key="canvasLocation" x="2798" y="932"/>
460476 </scene>
477+ <!--People To Write View Controller-->
478+ <scene sceneID="6Td-bq-Ebf">
479+ <objects>
480+ <tableViewController storyboardIdentifier="PeopleToWriteViewController" id="rUc-Tv-hWE" customClass="PeopleToWriteViewController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
481+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="PDb-NB-Ey6">
482+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
483+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
484+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
485+ <prototypes>
486+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="peopleToWriteCell" textLabel="e4H-yo-W57" detailTextLabel="QSb-Bd-4gu" style="IBUITableViewCellStyleValue1" id="5ue-Sf-Blf">
487+ <rect key="frame" x="0.0" y="28" width="375" height="44"/>
488+ <autoresizingMask key="autoresizingMask"/>
489+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="5ue-Sf-Blf" id="8Dr-YE-x7M">
490+ <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
491+ <autoresizingMask key="autoresizingMask"/>
492+ <subviews>
493+ <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="e4H-yo-W57">
494+ <rect key="frame" x="16" y="12" width="33.5" height="20.5"/>
495+ <autoresizingMask key="autoresizingMask"/>
496+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
497+ <nil key="textColor"/>
498+ <nil key="highlightedColor"/>
499+ </label>
500+ <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="QSb-Bd-4gu">
501+ <rect key="frame" x="315" y="12" width="44" height="20.5"/>
502+ <autoresizingMask key="autoresizingMask"/>
503+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
504+ <nil key="textColor"/>
505+ <nil key="highlightedColor"/>
506+ </label>
507+ </subviews>
508+ </tableViewCellContentView>
509+ </tableViewCell>
510+ </prototypes>
511+ <connections>
512+ <outlet property="dataSource" destination="rUc-Tv-hWE" id="cuc-oZ-Sna"/>
513+ <outlet property="delegate" destination="rUc-Tv-hWE" id="hw6-6X-Rlx"/>
514+ </connections>
515+ </tableView>
516+ </tableViewController>
517+ <placeholder placeholderIdentifier="IBFirstResponder" id="Zp5-b5-nn2" userLabel="First Responder" sceneMemberID="firstResponder"/>
518+ </objects>
519+ <point key="canvasLocation" x="3614" y="938"/>
520+ </scene>
521+ <!--Dialog View Controller-->
522+ <scene sceneID="9ac-1R-s4m">
523+ <objects>
524+ <tableViewController storyboardIdentifier="DialogViewController" id="AVr-rR-mka" customClass="DialogViewController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
525+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="NlQ-jM-tQP">
526+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
527+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
528+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
529+ <prototypes>
530+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="bgd-9d-SmR">
531+ <rect key="frame" x="0.0" y="28" width="375" height="44"/>
532+ <autoresizingMask key="autoresizingMask"/>
533+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="bgd-9d-SmR" id="9W4-bO-4MN">
534+ <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
535+ <autoresizingMask key="autoresizingMask"/>
536+ </tableViewCellContentView>
537+ </tableViewCell>
538+ </prototypes>
539+ <connections>
540+ <outlet property="dataSource" destination="AVr-rR-mka" id="quz-3V-jDT"/>
541+ <outlet property="delegate" destination="AVr-rR-mka" id="R4y-E9-LVr"/>
542+ </connections>
543+ </tableView>
544+ </tableViewController>
545+ <placeholder placeholderIdentifier="IBFirstResponder" id="Tzh-O8-O7T" userLabel="First Responder" sceneMemberID="firstResponder"/>
546+ </objects>
547+ <point key="canvasLocation" x="4336" y="937"/>
548+ </scene>
461549 <!--Posts-->
462550 <scene sceneID="RSd-UJ-34B">
463551 <objects>
GDproject/Constants.swift+5−1
@@ -43,9 +43,13 @@ let newsController = "NewsController"
4343/// constant for switching to view controller for log in app
4444let logInController = "LogInController"
4545
46−// constant for getting to messages
46+/// constant for getting to messages
4747let messagesViewControllerId = "MessagesViewController"
4848
49+/// constant for displaying list of people to send message to
50+let peopleToWriteVC = "PeopleToWriteViewController"
51+
52+let dialogVC = "DialogViewController"
4953
5054let profileViewController = "ProfileViewController"
5155
GDproject/Controller/Coordinators/MessagesCoordinator.swift+13
@@ -27,6 +27,19 @@ class MessagesCoordinator: BaseCoordinator {
2727
2828 private func show(){
2929 let vc = storyboard.instantiateViewController(withIdentifier: messagesViewControllerId) as! MessagesViewController
30+
31+ // choose person to write message to
32+ vc.onUserDisplayList = { [weak vc, unowned self] in
33+
34+ let newVC = self.storyboard.instantiateViewController(withIdentifier: peopleToWriteVC) as! PeopleToWriteViewController
35+ vc?.navigationController?.pushViewController(newVC, animated: true)
36+ }
37+
38+ vc.onDialogDisplay = { [weak vc, unowned self] in
39+ let newVC = self.storyboard.instantiateViewController(withIdentifier: dialogVC) as! DialogViewController
40+ newVC.currentDialog = $0
41+ vc?.navigationController?.pushViewController(newVC, animated: true)
42+ }
3043 navigationController?.viewControllers = [vc]
3144 }
3245}
GDproject/Controller/Messages/DialogViewController.swiftnew file+90
@@ -0,0 +1,90 @@
1+//
2+// DialogViewController.swift
3+// GDproject
4+//
5+// Created by cstore on 01/05/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class DialogViewController: UITableViewController {
12+
13+ var currentDialog: (id: Int, name: String)?
14+
15+ override func viewDidLoad() {
16+ super.viewDidLoad()
17+
18+ if let person = currentDialog {
19+ navigationItem.title = person.name
20+ }
21+ }
22+
23+ // MARK: - Table view data source
24+
25+ override func numberOfSections(in tableView: UITableView) -> Int {
26+ // #warning Incomplete implementation, return the number of sections
27+ return 0
28+ }
29+
30+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
31+ // #warning Incomplete implementation, return the number of rows
32+ return 0
33+ }
34+
35+ /*
36+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
37+ let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
38+
39+ // Configure the cell...
40+
41+ return cell
42+ }
43+ */
44+
45+ /*
46+ // Override to support conditional editing of the table view.
47+ override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
48+ // Return false if you do not want the specified item to be editable.
49+ return true
50+ }
51+ */
52+
53+ /*
54+ // Override to support editing the table view.
55+ override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
56+ if editingStyle == .delete {
57+ // Delete the row from the data source
58+ tableView.deleteRows(at: [indexPath], with: .fade)
59+ } else if editingStyle == .insert {
60+ // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
61+ }
62+ }
63+ */
64+
65+ /*
66+ // Override to support rearranging the table view.
67+ override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
68+
69+ }
70+ */
71+
72+ /*
73+ // Override to support conditional rearranging of the table view.
74+ override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
75+ // Return false if you do not want the item to be re-orderable.
76+ return true
77+ }
78+ */
79+
80+ /*
81+ // MARK: - Navigation
82+
83+ // In a storyboard-based application, you will often want to do a little preparation before navigation
84+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
85+ // Get the new view controller using segue.destination.
86+ // Pass the selected object to the new view controller.
87+ }
88+ */
89+
90+}
GDproject/Controller/Messages/MessagesViewController.swift+38−15
@@ -10,38 +10,61 @@ import UIKit
1010
1111class MessagesViewController: UITableViewController {
1212
13+ // curreent Active which can be displayed
14+ var currentActiveDialogs: [(id: Int, name: String)] = [(id: Int, name: String)]()
15+
16+ var onUserDisplayList: (()->())?
17+
18+ var onDialogDisplay: (((id: Int, name: String))->())?
19+
20+ let searchC = UISearchController(searchResultsController: nil)
21+
1322 override func viewDidLoad() {
1423 super.viewDidLoad()
1524
16− // Uncomment the following line to preserve selection between presentations
17− // self.clearsSelectionOnViewWillAppear = false
18−
1925 // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
20− // self.navigationItem.rightBarButtonItem = self.editButtonItem
26+ self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Write", style: .plain, target: self, action: #selector(choosePerson))
27+
28+ self.navigationItem.title = "Messages"
29+ // self.navigationItem.largeTitleDisplayMode = .always
30+ self.navigationItem.searchController = searchC
31+ navigationController?.navigationBar.prefersLargeTitles = true
32+ self.navigationItem.hidesSearchBarWhenScrolling = false
2133 }
2234
35+ @objc func choosePerson(){
36+ onUserDisplayList?()
37+ }
38+
39+ override func viewWillAppear(_ animated: Bool) {
40+ super.viewWillAppear(animated)
41+
42+ tableView.reloadData()
43+ }
2344 // MARK: - Table view data source
2445
2546 override func numberOfSections(in tableView: UITableView) -> Int {
26− // #warning Incomplete implementation, return the number of sections
27− return 0
47+ return 1
2848 }
2949
3050 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
31− // #warning Incomplete implementation, return the number of rows
32− return 0
51+ return currentActiveDialogs.count
3352 }
3453
35− /*
36− override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
37− let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
38−
39− // Configure the cell...
54+
55+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
56+ {
57+ let cell = tableView.dequeueReusableCell(withIdentifier: "MessagesCell", for: indexPath)
58+
59+ cell.textLabel?.text = currentActiveDialogs[indexPath.row].name
60+ cell.detailTextLabel?.text = "from \(currentActiveDialogs[indexPath.row].name) some message is displayed here..."
4061
4162 return cell
4263 }
43− */
44−
64+
65+ override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
66+ onDialogDisplay?(currentActiveDialogs[indexPath.row])
67+ }
4568 /*
4669 // Override to support conditional editing of the table view.
4770 override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
GDproject/Controller/Messages/PeopleToWriteViewController.swiftnew file+106
@@ -0,0 +1,106 @@
1+//
2+// PeopleToWriteViewController.swift
3+// GDproject
4+//
5+// Created by cstore on 01/05/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class PeopleToWriteViewController: UITableViewController {
12+
13+ let searchC = UISearchController(searchResultsController: nil)
14+
15+ let users = [(id: 9,name: "Anna Mikhaleva")]
16+
17+ override func viewDidLoad() {
18+ super.viewDidLoad()
19+
20+ self.navigationItem.title = "People"
21+ self.navigationItem.largeTitleDisplayMode = .never
22+ self.navigationItem.searchController = searchC
23+ self.navigationItem.hidesSearchBarWhenScrolling = false
24+ }
25+
26+ // MARK: - Table view data source
27+
28+ override func numberOfSections(in tableView: UITableView) -> Int {
29+ // #warning Incomplete implementation, return the number of sections
30+ return 1
31+ }
32+
33+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
34+ // #warning Incomplete implementation, return the number of rows
35+ return users.count
36+ }
37+
38+
39+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
40+ {
41+ let cell = tableView.dequeueReusableCell(withIdentifier: "peopleToWriteCell", for: indexPath)
42+
43+ cell.textLabel?.text = users[indexPath.row].name
44+ cell.detailTextLabel?.text = "\(users[indexPath.row].id)"
45+
46+ return cell
47+ }
48+
49+ override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
50+ navigationController?.popViewController(animated: true)
51+
52+ guard let _ = self.navigationController?.viewControllers.lastIndex(of: self) else
53+ {
54+ (navigationController?.viewControllers.last as? MessagesViewController)?.currentActiveDialogs.append(users[indexPath.row])
55+ (navigationController?.viewControllers.last as? MessagesViewController)?.onDialogDisplay?(users[indexPath.row])
56+ return
57+ }
58+ }
59+
60+
61+ /*
62+ // Override to support conditional editing of the table view.
63+ override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
64+ // Return false if you do not want the specified item to be editable.
65+ return true
66+ }
67+ */
68+
69+ /*
70+ // Override to support editing the table view.
71+ override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
72+ if editingStyle == .delete {
73+ // Delete the row from the data source
74+ tableView.deleteRows(at: [indexPath], with: .fade)
75+ } else if editingStyle == .insert {
76+ // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
77+ }
78+ }
79+ */
80+
81+ /*
82+ // Override to support rearranging the table view.
83+ override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
84+
85+ }
86+ */
87+
88+ /*
89+ // Override to support conditional rearranging of the table view.
90+ override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
91+ // Return false if you do not want the item to be re-orderable.
92+ return true
93+ }
94+ */
95+
96+ /*
97+ // MARK: - Navigation
98+
99+ // In a storyboard-based application, you will often want to do a little preparation before navigation
100+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
101+ // Get the new view controller using segue.destination.
102+ // Pass the selected object to the new view controller.
103+ }
104+ */
105+
106+}