git.iko.soy/dashared/GDproject
on master help sign in
channels are created. editing mode is availiable
commitddfc937059e5179a9c4802d6aa1fae25cafc16c7 authorDarya Rednikina <rednikina.com@yandex.ru> dateTue 19 Feb 2019, 22:16 (8 years ago) parente6e94ee
7 files changed+348−5
GDproject.xcodeproj/project.pbxproj+8 GDproject/Base.lproj/Main.storyboard+95 GDproject/Constants.swift+7 GDproject/Controller/ChannelController.swift+153 GDproject/Controller/ChannelListController.swift+77 GDproject/Controller/News/NewsController.swift+3−5 GDproject/Controller/News/NewsVC.swift+5
GDproject.xcodeproj/project.pbxproj+8
@@ -10,6 +10,8 @@
1010 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57C22171D2A008A3575 /* ProfileViewController.swift */; };
1111 125BD57F22171D73008A3575 /* Extentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57E22171D73008A3575 /* Extentions.swift */; };
1212 125BD5812217314A008A3575 /* NewsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD5802217314A008A3575 /* NewsVC.swift */; };
13+ 12D7D133221C321600B35452 /* ChannelListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D132221C321600B35452 /* ChannelListController.swift */; };
14+ 12D7D135221C42B700B35452 /* ChannelController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D134221C42B700B35452 /* ChannelController.swift */; };
1315 12DB7FD722181CD20096878E /* BasicInfoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12DB7FD622181CD20096878E /* BasicInfoController.swift */; };
1416 12DB7FD922181E660096878E /* BasicInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12DB7FD822181E660096878E /* BasicInfoCell.swift */; };
1517 12DB7FDB2218590C0096878E /* InfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12DB7FDA2218590C0096878E /* InfoCell.swift */; };
@@ -61,6 +63,8 @@
6163 125BD57C22171D2A008A3575 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
6264 125BD57E22171D73008A3575 /* Extentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extentions.swift; sourceTree = "<group>"; };
6365 125BD5802217314A008A3575 /* NewsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsVC.swift; sourceTree = "<group>"; };
66+ 12D7D132221C321600B35452 /* ChannelListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelListController.swift; sourceTree = "<group>"; };
67+ 12D7D134221C42B700B35452 /* ChannelController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelController.swift; sourceTree = "<group>"; };
6468 12DB7FD622181CD20096878E /* BasicInfoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicInfoController.swift; sourceTree = "<group>"; };
6569 12DB7FD822181E660096878E /* BasicInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicInfoCell.swift; sourceTree = "<group>"; };
6670 12DB7FDA2218590C0096878E /* InfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoCell.swift; sourceTree = "<group>"; };
@@ -162,6 +166,8 @@
162166 12E36DCF22145923006FCDD7 /* Controller */ = {
163167 isa = PBXGroup;
164168 children = (
169+ 12D7D134221C42B700B35452 /* ChannelController.swift */,
170+ 12D7D132221C321600B35452 /* ChannelListController.swift */,
165171 125BD57C22171D2A008A3575 /* ProfileViewController.swift */,
166172 12DB7FDE221877160096878E /* InviteViewController.swift */,
167173 12DB7FDC221872F80096878E /* SettingsViewController.swift */,
@@ -273,10 +279,12 @@
273279 12E36D9E221424EA006FCDD7 /* NewsController.swift in Sources */,
274280 12E36DCC22144725006FCDD7 /* PostViewCell.swift in Sources */,
275281 125BD57F22171D73008A3575 /* Extentions.swift in Sources */,
282+ 12D7D133221C321600B35452 /* ChannelListController.swift in Sources */,
276283 12E36DD122148122006FCDD7 /* FullPostController.swift in Sources */,
277284 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */,
278285 12DB7FDB2218590C0096878E /* InfoCell.swift in Sources */,
279286 12DB7FD922181E660096878E /* BasicInfoCell.swift in Sources */,
287+ 12D7D135221C42B700B35452 /* ChannelController.swift in Sources */,
280288 12E36D9C221424EA006FCDD7 /* AppDelegate.swift in Sources */,
281289 12DB7FD722181CD20096878E /* BasicInfoController.swift in Sources */,
282290 12E36DCE22144756006FCDD7 /* Constants.swift in Sources */,
GDproject/Base.lproj/Main.storyboard+95
@@ -245,6 +245,101 @@
245245 </objects>
246246 <point key="canvasLocation" x="2803" y="1756"/>
247247 </scene>
248+ <!--Channel List Controller-->
249+ <scene sceneID="4eb-Jz-gcx">
250+ <objects>
251+ <tableViewController storyboardIdentifier="ChannelListController" id="VzJ-FE-nbt" customClass="ChannelListController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
252+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="5RL-OH-B9N">
253+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
254+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
255+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
256+ <prototypes>
257+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="ChannelCell" textLabel="MAo-lZ-MFd" detailTextLabel="KTs-9K-R13" style="IBUITableViewCellStyleSubtitle" id="65E-UC-AJO">
258+ <rect key="frame" x="0.0" y="28" width="375" height="44"/>
259+ <autoresizingMask key="autoresizingMask"/>
260+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="65E-UC-AJO" id="N5k-ip-WkW">
261+ <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
262+ <autoresizingMask key="autoresizingMask"/>
263+ <subviews>
264+ <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="MAo-lZ-MFd">
265+ <rect key="frame" x="16" y="5" width="33.5" height="20.5"/>
266+ <autoresizingMask key="autoresizingMask"/>
267+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
268+ <nil key="textColor"/>
269+ <nil key="highlightedColor"/>
270+ </label>
271+ <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Subtitle" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="KTs-9K-R13">
272+ <rect key="frame" x="16" y="25.5" width="44" height="14.5"/>
273+ <autoresizingMask key="autoresizingMask"/>
274+ <fontDescription key="fontDescription" type="system" pointSize="12"/>
275+ <nil key="textColor"/>
276+ <nil key="highlightedColor"/>
277+ </label>
278+ </subviews>
279+ </tableViewCellContentView>
280+ </tableViewCell>
281+ </prototypes>
282+ <connections>
283+ <outlet property="dataSource" destination="VzJ-FE-nbt" id="XQW-UU-t6A"/>
284+ <outlet property="delegate" destination="VzJ-FE-nbt" id="xee-fv-SfO"/>
285+ </connections>
286+ </tableView>
287+ </tableViewController>
288+ <placeholder placeholderIdentifier="IBFirstResponder" id="9RU-Bp-4K5" userLabel="First Responder" sceneMemberID="firstResponder"/>
289+ </objects>
290+ <point key="canvasLocation" x="2708" y="-597"/>
291+ </scene>
292+ <!--Channel Controller-->
293+ <scene sceneID="ugM-Od-pJd">
294+ <objects>
295+ <viewController storyboardIdentifier="ChannelController" id="SgI-bH-MqV" customClass="ChannelController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
296+ <view key="view" contentMode="scaleToFill" id="edj-KS-H90">
297+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
298+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
299+ <subviews>
300+ <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="fye-z6-WKO">
301+ <rect key="frame" x="0.0" y="20" width="375" height="647"/>
302+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
303+ <view key="tableHeaderView" contentMode="scaleToFill" id="5My-GH-WDq">
304+ <rect key="frame" x="0.0" y="0.0" width="375" height="54"/>
305+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
306+ <subviews>
307+ <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Title" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="VFE-We-ctc">
308+ <rect key="frame" x="8" y="12" width="359" height="30"/>
309+ <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
310+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
311+ <textInputTraits key="textInputTraits"/>
312+ </textField>
313+ </subviews>
314+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
315+ <constraints>
316+ <constraint firstItem="VFE-We-ctc" firstAttribute="leading" secondItem="5My-GH-WDq" secondAttribute="leading" constant="8" id="HBN-OE-miW"/>
317+ <constraint firstItem="VFE-We-ctc" firstAttribute="top" secondItem="5My-GH-WDq" secondAttribute="top" constant="12" id="N8q-hz-5yP"/>
318+ <constraint firstAttribute="bottom" secondItem="VFE-We-ctc" secondAttribute="bottom" constant="12" id="jqO-53-maF"/>
319+ <constraint firstAttribute="trailing" secondItem="VFE-We-ctc" secondAttribute="trailing" constant="8" id="zYt-AY-R9F"/>
320+ </constraints>
321+ </view>
322+ </tableView>
323+ </subviews>
324+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
325+ <constraints>
326+ <constraint firstItem="C5s-a1-LTb" firstAttribute="bottom" secondItem="fye-z6-WKO" secondAttribute="bottom" id="HUf-vU-oDj"/>
327+ <constraint firstItem="fye-z6-WKO" firstAttribute="leading" secondItem="C5s-a1-LTb" secondAttribute="leading" id="Hbj-fv-SB5"/>
328+ <constraint firstItem="fye-z6-WKO" firstAttribute="top" secondItem="C5s-a1-LTb" secondAttribute="top" id="dcM-jB-W3m"/>
329+ <constraint firstItem="C5s-a1-LTb" firstAttribute="trailing" secondItem="fye-z6-WKO" secondAttribute="trailing" id="zHE-tP-Siv"/>
330+ </constraints>
331+ <viewLayoutGuide key="safeArea" id="C5s-a1-LTb"/>
332+ </view>
333+ <connections>
334+ <outlet property="tableView" destination="fye-z6-WKO" id="S11-YV-PU6"/>
335+ <outlet property="textField" destination="VFE-We-ctc" id="6pP-P4-zg8"/>
336+ <outlet property="viewww" destination="5My-GH-WDq" id="SS0-Mi-QWf"/>
337+ </connections>
338+ </viewController>
339+ <placeholder placeholderIdentifier="IBFirstResponder" id="fzv-8a-15V" userLabel="First Responder" sceneMemberID="firstResponder"/>
340+ </objects>
341+ <point key="canvasLocation" x="3560.8000000000002" y="-597.75112443778119"/>
342+ </scene>
248343 <!--New Post View Controller-->
249344 <scene sceneID="TVK-xu-UdJ">
250345 <objects>
GDproject/Constants.swift+7
@@ -19,3 +19,10 @@ let infoCellId = "InfoCell"
1919
2020let inviteVC = "InviteViewController"
2121
22+let channelCellId = "ChannelCell"
23+
24+let channelListControllerId = "ChannelListController"
25+
26+let itemCellId = "ItemCell"
27+
28+let channelControllerId = "ChannelController"
GDproject/Controller/ChannelController.swiftnew file+153
@@ -0,0 +1,153 @@
1+//
2+// ChannelController.swift
3+// GDproject
4+//
5+// Created by cstore on 19/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class ChannelController: UIViewController, UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, UISearchBarDelegate
12+{
13+ @IBOutlet weak var tableView: UITableView!
14+
15+ var dataSource: [String] = []
16+
17+ var people: [String] = ["Ann", "Ilya", "Kostya"]
18+ var fullPeople: [String] = ["Other Ann", "Other Ilya", "Other Kostya", "Pasha", "Valera"]
19+ var tags: [String] = ["# foo", "# bar", "# kek"]
20+ var fullTags: [String] = ["# happy", "# sad", "# meme", "# shershakov", "# pupsik"]
21+
22+ @IBOutlet weak var viewww: UIView!
23+
24+ @IBOutlet weak var textField: UITextField!
25+
26+ override func viewDidLoad() {
27+ super.viewDidLoad()
28+ tableView.delegate = self
29+ tableView.dataSource = self
30+ dataSource = people
31+ tableView.register(UITableViewCell.self, forCellReuseIdentifier: itemCellId)
32+ tableView.reloadData()
33+ textField.delegate = self
34+ searchBar.delegate = self
35+ searchBar.selectedScopeButtonIndex = 0
36+ navigationItem.title = "Title"
37+ }
38+
39+
40+ func numberOfSections(in tableView: UITableView) -> Int {
41+ return 1
42+ }
43+
44+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
45+ return dataSource.count
46+ }
47+
48+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
49+ let cell = tableView.dequeueReusableCell(withIdentifier: itemCellId, for: indexPath)
50+
51+ cell.textLabel?.text = dataSource[indexPath.row]
52+ return cell
53+ }
54+
55+ func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
56+ return 100
57+ }
58+
59+ let searchBar: UISearchBar = {
60+ let searchBar = UISearchBar(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 70))
61+ searchBar.showsScopeBar = true
62+ searchBar.showsCancelButton = true
63+ searchBar.scopeButtonTitles = ["People", "Tags"]
64+ return searchBar
65+ }()
66+
67+ func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
68+ {
69+ let view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 70))
70+
71+ if flag {
72+ searchBar.selectedScopeButtonIndex = 1
73+ } else {
74+ searchBar.selectedScopeButtonIndex = 0
75+ }
76+
77+ view.addSubview(searchBar)
78+ return view
79+ }
80+
81+ //change
82+ func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
83+ navigationItem.title = textField.text
84+ return true
85+ }
86+
87+ func textFieldShouldReturn(_ textField: UITextField) -> Bool
88+ {
89+ textField.resignFirstResponder()
90+ return true
91+ }
92+
93+ func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
94+ if searchText.isEmpty {
95+ dataSource = searchBar.selectedScopeButtonIndex == 0 ? fullPeople : fullTags
96+ tableView.reloadData()
97+ } else {
98+ filterTableView(ind: searchBar.selectedScopeButtonIndex, text: searchText)
99+ }
100+ }
101+
102+ func filterTableView(ind: Int, text: String){
103+ switch ind {
104+ case 0:
105+ dataSource = fullPeople.filter({ (s) -> Bool in
106+ s.lowercased().contains(text.lowercased())
107+ })
108+ tableView.reloadData()
109+ case 1:
110+ dataSource = fullTags.filter({ (s) -> Bool in
111+ s.lowercased().contains(text.lowercased())
112+ })
113+ tableView.reloadData()
114+ default:
115+ break
116+ }
117+ }
118+
119+ var flag = false
120+
121+ func searchBar(_ searchBar: UISearchBar, selectedScopeButtonIndexDidChange selectedScope: Int) {
122+ if searchBar.isFirstResponder {
123+ dataSource = searchBar.selectedScopeButtonIndex == 0 ? fullPeople : fullTags
124+ flag = searchBar.selectedScopeButtonIndex == 0 ? false : true
125+ if (!(searchBar.text?.isEmpty ?? true))
126+ {
127+ filterTableView(ind: selectedScope, text: searchBar.text!)
128+ }
129+ tableView.reloadData()
130+ } else if !(searchBar.isFirstResponder){
131+ dataSource = searchBar.selectedScopeButtonIndex == 0 ? people : tags
132+ flag = searchBar.selectedScopeButtonIndex == 0 ? false : true
133+ tableView.reloadData()
134+ }
135+ }
136+
137+ func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
138+ dataSource = searchBar.selectedScopeButtonIndex == 0 ? people : tags
139+ flag = searchBar.selectedScopeButtonIndex == 0 ? false : true
140+ tableView.reloadData()
141+ }
142+
143+ func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
144+ dataSource = searchBar.selectedScopeButtonIndex == 0 ? fullPeople : fullTags
145+ flag = searchBar.selectedScopeButtonIndex == 0 ? false : true
146+ tableView.reloadData()
147+ }
148+
149+ func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
150+ searchBar.text = ""
151+ searchBar.resignFirstResponder()
152+ }
153+}
GDproject/Controller/ChannelListController.swiftnew file+77
@@ -0,0 +1,77 @@
1+//
2+// ChannelListController.swift
3+// GDproject
4+//
5+// Created by cstore on 19/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+struct ChannelData{
12+ var title = String()
13+ var subtitle = String()
14+}
15+
16+// TODO: make search controller availiable
17+class ChannelListController: UITableViewController{
18+
19+ var searchController = UISearchController(searchResultsController: nil)
20+
21+ override func viewDidLoad() {
22+ super.viewDidLoad()
23+ setUpNavigationBar()
24+ navigationItem.title = "Channels"
25+
26+ searchController.searchBar.placeholder = "Search anything"
27+ navigationItem.searchController = searchController
28+ }
29+
30+ func setUpNavigationBar(){
31+ navigationItem.rightBarButtonItems = [UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(addChannel))]
32+ }
33+
34+ @objc func addChannel(){
35+ print("Add channel")
36+ }
37+
38+ var dataSource: [ChannelData] = [ ChannelData(title: "Channel 1", subtitle: "Some info about channel"),
39+ ChannelData(title: "Channel 2", subtitle: "Some info about channel"),
40+ ChannelData(title: "Channel 3", subtitle: "Some info about channel")]
41+
42+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
43+ return dataSource.count
44+ }
45+
46+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
47+ let cell = tableView.dequeueReusableCell(withIdentifier: channelCellId, for: indexPath)
48+ cell.textLabel?.text = dataSource[indexPath.row].title
49+ cell.detailTextLabel?.text = dataSource[indexPath.row].subtitle
50+
51+ return cell
52+ }
53+
54+
55+ override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
56+ return true
57+ }
58+
59+ override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
60+ let editButton = UITableViewRowAction(style: .normal, title: "Edit") { [weak self] (action, indexPath) in
61+ let vc = self?.storyboard?.instantiateViewController(withIdentifier: channelControllerId) as! ChannelController
62+
63+ self?.navigationController?.pushViewController(vc, animated: true)
64+ }
65+ editButton.backgroundColor = .green
66+
67+ let deleteButton = UITableViewRowAction(style: .normal, title: "Delete") { [weak self] (action, indexPath) in
68+ self?.tableView.beginUpdates()
69+ self?.dataSource.remove(at: indexPath.row)
70+ self?.tableView.deleteRows(at: [indexPath], with: .none)
71+ self?.tableView.endUpdates()
72+ }
73+ deleteButton.backgroundColor = .red
74+
75+ return [editButton, deleteButton]
76+ }
77+}
GDproject/Controller/News/NewsController.swift+3−5
@@ -56,7 +56,7 @@ class NewsController: UIViewController, UISearchControllerDelegate, UITableViewD
5656 tableView.register(PostViewCell.self, forCellReuseIdentifier: postCellId)
5757 tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
5858
59− //searchController.delegate = self
59+ searchController.delegate = self
6060 searchController.obscuresBackgroundDuringPresentation = false
6161
6262 news.dataSourse = dataSourse
@@ -138,7 +138,7 @@ class NewsController: UIViewController, UISearchControllerDelegate, UITableViewD
138138 tableView.reloadData()
139139 }
140140
141− //navigationItem.rightBarButtonItems = [UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(addChannel))]
141+
142142
143143 @objc func writePost(_ barItem: UIBarButtonItem)
144144 {
@@ -158,9 +158,7 @@ class NewsController: UIViewController, UISearchControllerDelegate, UITableViewD
158158 navigationController?.pushViewController(vc, animated: false)
159159 }
160160
161− @objc func addChannel(){
162− print("Add channel")
163− }
161+
164162
165163 // for animating the banner
166164 var topConstraint: NSLayoutConstraint?
GDproject/Controller/News/NewsVC.swift+5
@@ -35,6 +35,11 @@ class NewsVC: UIViewController, UITableViewDelegate, UITableViewDataSource{
3535 vc.post = dataSourse[indexPath.row]
3636 viewController!.navigationController!.pushViewController(vc, animated: true)
3737 }
38+ else if indexPath.section == 0 && type == .NEWS{
39+ let vc = viewController!.storyboard!.instantiateViewController(withIdentifier: channelListControllerId) as! ChannelListController
40+
41+ viewController!.navigationController!.pushViewController(vc, animated: true)
42+ }
3843 }
3944
4045 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {