git.iko.soy/dashared/GDproject
on master help sign in
Finished pagination. Deleted pulley.
commitd78240516072416644655c50f6cf769f8fb28787 authorDarya Rednikina <rednikina.com@yandex.ru> dateWed 1 May 2019, 11:24 (7 years ago) parentbce7fa1
5 files changed+50−222
GDproject/Base.lproj/Main.storyboard+16−166 GDproject/Controller/ News and channels/ChannelListController.swift+1−1 GDproject/Controller/ News and channels/NewsController.swift+1−1 GDproject/Controller/ News and channels/NewsVC.swift+8−3 GDproject/Controller/Coordinators/ChannelsCoordinator.swift+24−51
GDproject/Base.lproj/Main.storyboard+16−166
@@ -1,11 +1,11 @@
11<?xml version="1.0" encoding="UTF-8"?>
2−<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33 <device id="retina4_7" orientation="portrait">
44 <adaptation id="fullscreen"/>
55 </device>
66 <dependencies>
77 <deployment identifier="iOS"/>
8− <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
8+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
99 <capability name="Safe area layout guides" minToolsVersion="9.0"/>
1010 <capability name="Stack View standard spacing" minToolsVersion="9.0"/>
1111 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -416,45 +416,6 @@
416416 </objects>
417417 <point key="canvasLocation" x="3444" y="129.98500749625188"/>
418418 </scene>
419− <!--Pulley View Controller-->
420− <scene sceneID="cBw-kf-fO5">
421− <objects>
422− <viewController id="IbM-Ix-dsI" customClass="PulleyViewController" customModule="Pulley" sceneMemberID="viewController">
423− <view key="view" contentMode="scaleToFill" id="hBO-ys-jBX">
424− <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
425− <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
426− <subviews>
427− <containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JAV-ei-FE9">
428− <rect key="frame" x="0.0" y="343.5" width="375" height="323.5"/>
429− <connections>
430− <segue destination="gBC-pa-4Y8" kind="embed" id="e5o-yX-vfJ"/>
431− </connections>
432− </containerView>
433− <containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="KD4-lL-5lI">
434− <rect key="frame" x="0.0" y="20" width="375" height="323.5"/>
435− <connections>
436− <segue destination="sPi-8s-ya2" kind="embed" id="0dA-aV-epC"/>
437− </connections>
438− </containerView>
439− </subviews>
440− <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
441− <constraints>
442− <constraint firstItem="AM9-XR-Q11" firstAttribute="trailing" secondItem="JAV-ei-FE9" secondAttribute="trailing" id="0nc-wd-359"/>
443− <constraint firstItem="JAV-ei-FE9" firstAttribute="top" secondItem="KD4-lL-5lI" secondAttribute="bottom" id="2ap-xA-MZc"/>
444− <constraint firstItem="KD4-lL-5lI" firstAttribute="top" secondItem="AM9-XR-Q11" secondAttribute="top" id="57N-k9-3Da"/>
445− <constraint firstItem="KD4-lL-5lI" firstAttribute="leading" secondItem="AM9-XR-Q11" secondAttribute="leading" id="KS0-2b-0Zn"/>
446− <constraint firstItem="KD4-lL-5lI" firstAttribute="height" secondItem="JAV-ei-FE9" secondAttribute="height" id="W9b-Gn-1ZT"/>
447− <constraint firstItem="AM9-XR-Q11" firstAttribute="trailing" secondItem="KD4-lL-5lI" secondAttribute="trailing" id="bxO-FD-qi7"/>
448− <constraint firstItem="AM9-XR-Q11" firstAttribute="bottom" secondItem="JAV-ei-FE9" secondAttribute="bottom" id="eCt-RJ-W5F"/>
449− <constraint firstItem="JAV-ei-FE9" firstAttribute="leading" secondItem="AM9-XR-Q11" secondAttribute="leading" id="tJO-om-OjN"/>
450− </constraints>
451− <viewLayoutGuide key="safeArea" id="AM9-XR-Q11"/>
452− </view>
453− </viewController>
454− <placeholder placeholderIdentifier="IBFirstResponder" id="dJR-ry-ymY" userLabel="First Responder" sceneMemberID="firstResponder"/>
455− </objects>
456− <point key="canvasLocation" x="5055.1999999999998" y="757.87106446776613"/>
457− </scene>
458419 <!--Posts-->
459420 <scene sceneID="RSd-UJ-34B">
460421 <objects>
@@ -506,146 +467,35 @@
506467 </objects>
507468 <point key="canvasLocation" x="-466" y="641"/>
508469 </scene>
509− <!--Pulley View Controller-->
510− <scene sceneID="UoF-Qk-BM8">
511− <objects>
512− <viewController id="2Yu-1o-yft" customClass="PulleyViewController" customModule="Pulley" sceneMemberID="viewController">
513− <view key="view" contentMode="scaleToFill" id="3et-u3-dSP">
514− <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
515− <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
516− <subviews>
517− <containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="za7-bL-mv7">
518− <rect key="frame" x="0.0" y="20" width="375" height="323.5"/>
519− <connections>
520− <segue destination="ulF-DZ-X8U" kind="embed" id="AAL-by-ugl"/>
521− </connections>
522− </containerView>
523− <containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iWE-c6-fco">
524− <rect key="frame" x="0.0" y="343.5" width="375" height="323.5"/>
525− <connections>
526− <segue destination="WeI-zO-7Eh" kind="embed" id="JkK-vq-eWP"/>
527− </connections>
528− </containerView>
529− </subviews>
530− <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
531− <constraints>
532− <constraint firstItem="iWE-c6-fco" firstAttribute="leading" secondItem="3L3-Xf-lna" secondAttribute="leading" id="Exq-4M-b4b"/>
533− <constraint firstItem="3L3-Xf-lna" firstAttribute="trailing" secondItem="iWE-c6-fco" secondAttribute="trailing" id="FCK-0g-Hkx"/>
534− <constraint firstItem="3L3-Xf-lna" firstAttribute="trailing" secondItem="za7-bL-mv7" secondAttribute="trailing" id="HQc-5t-Y2J"/>
535− <constraint firstItem="iWE-c6-fco" firstAttribute="height" secondItem="za7-bL-mv7" secondAttribute="height" id="Lnu-CN-lkp"/>
536− <constraint firstItem="za7-bL-mv7" firstAttribute="top" secondItem="3L3-Xf-lna" secondAttribute="top" id="XlM-4t-IZF"/>
537− <constraint firstItem="za7-bL-mv7" firstAttribute="leading" secondItem="3L3-Xf-lna" secondAttribute="leading" id="gft-5C-vKC"/>
538− <constraint firstItem="3L3-Xf-lna" firstAttribute="bottom" secondItem="iWE-c6-fco" secondAttribute="bottom" id="ied-zS-PJe"/>
539− <constraint firstItem="iWE-c6-fco" firstAttribute="top" secondItem="za7-bL-mv7" secondAttribute="bottom" id="wJe-FE-o3y"/>
540− </constraints>
541− <viewLayoutGuide key="safeArea" id="3L3-Xf-lna"/>
542− </view>
543− </viewController>
544− <placeholder placeholderIdentifier="IBFirstResponder" id="LNf-NC-tIC" userLabel="First Responder" sceneMemberID="firstResponder"/>
545− </objects>
546− <point key="canvasLocation" x="6568.8000000000002" y="-536.58170914542734"/>
547− </scene>
548− <!--News Controller-->
549− <scene sceneID="6SA-L8-PwW">
550− <objects>
551− <viewController storyboardIdentifier="NewsController" id="sPi-8s-ya2" customClass="NewsController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
552− <view key="view" contentMode="scaleToFill" id="Qwh-6O-iyN">
553− <rect key="frame" x="0.0" y="0.0" width="375" height="323.5"/>
554− <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
555− <subviews>
556− <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="4pw-5n-XsC">
557− <rect key="frame" x="0.0" y="0.0" width="375" height="323.5"/>
558− <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
559− </tableView>
560− </subviews>
561− <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
562− <constraints>
563− <constraint firstAttribute="bottomMargin" secondItem="4pw-5n-XsC" secondAttribute="bottom" id="iji-Cm-2Xx"/>
564− <constraint firstItem="4pw-5n-XsC" firstAttribute="top" secondItem="Qwh-6O-iyN" secondAttribute="topMargin" id="j2B-b5-dg7"/>
565− <constraint firstItem="4pw-5n-XsC" firstAttribute="leading" secondItem="Qwh-6O-iyN" secondAttribute="leading" id="nau-1I-Bh7"/>
566− <constraint firstAttribute="trailing" secondItem="4pw-5n-XsC" secondAttribute="trailing" id="vnT-kX-h1h"/>
567− </constraints>
568− <viewLayoutGuide key="safeArea" id="uUX-ik-SiW"/>
569− </view>
570− <connections>
571− <outlet property="tableView" destination="4pw-5n-XsC" id="usq-Vi-rXA"/>
572− </connections>
573− </viewController>
574− <placeholder placeholderIdentifier="IBFirstResponder" id="3Pe-af-1NZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
575− </objects>
576− <point key="canvasLocation" x="5890" y="482"/>
577− </scene>
578− <!--View Controller-->
579− <scene sceneID="LJw-Xf-aJT">
580− <objects>
581− <viewController storyboardIdentifier="DrawerContentViewController" id="gBC-pa-4Y8" sceneMemberID="viewController">
582− <view key="view" contentMode="scaleToFill" id="Z3E-He-aJI">
583− <rect key="frame" x="0.0" y="0.0" width="375" height="323.5"/>
584− <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
585− <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
586− <viewLayoutGuide key="safeArea" id="Vki-Ji-EOU"/>
587− </view>
588− </viewController>
589− <placeholder placeholderIdentifier="IBFirstResponder" id="KTe-P9-g8t" userLabel="First Responder" sceneMemberID="firstResponder"/>
590− </objects>
591− <point key="canvasLocation" x="5888.8000000000002" y="999.40029985007504"/>
592− </scene>
593− <!--View Controller-->
594− <scene sceneID="wC5-hU-UvA">
595− <objects>
596− <viewController storyboardIdentifier="DrawerContentViewController1" id="WeI-zO-7Eh" sceneMemberID="viewController">
597− <view key="view" contentMode="scaleToFill" id="JLv-bg-XLk">
598− <rect key="frame" x="0.0" y="0.0" width="375" height="323.5"/>
599− <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
600− <subviews>
601− <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zww-sy-694">
602− <rect key="frame" x="162" y="9" width="51" height="7"/>
603− <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
604− <constraints>
605− <constraint firstAttribute="height" constant="7" id="5CW-MN-dqc"/>
606− <constraint firstAttribute="width" constant="51" id="RzS-Ug-nLj"/>
607− </constraints>
608− </view>
609− </subviews>
610− <constraints>
611− <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="zww-sy-694" secondAttribute="bottom" constant="293.5" id="YkN-uN-QpE"/>
612− <constraint firstItem="zww-sy-694" firstAttribute="centerX" secondItem="JLv-bg-XLk" secondAttribute="centerX" id="drj-8r-0tX"/>
613− <constraint firstItem="zww-sy-694" firstAttribute="top" secondItem="JLv-bg-XLk" secondAttribute="top" constant="9" id="qA5-6a-1F4"/>
614− </constraints>
615− </view>
616− </viewController>
617− <placeholder placeholderIdentifier="IBFirstResponder" id="2Qo-34-wZp" userLabel="First Responder" sceneMemberID="firstResponder"/>
618− </objects>
619− <point key="canvasLocation" x="7640.8000000000002" y="-336.43178410794604"/>
620− </scene>
621470 <!--News Controller-->
622− <scene sceneID="RDE-dJ-rKL">
471+ <scene sceneID="kf1-SJ-kcp">
623472 <objects>
624− <viewController storyboardIdentifier="NewsController1" id="ulF-DZ-X8U" customClass="NewsController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
625− <view key="view" contentMode="scaleToFill" id="mOG-nL-CRD">
626− <rect key="frame" x="0.0" y="0.0" width="375" height="323.5"/>
473+ <viewController storyboardIdentifier="NewsController" id="R7p-5c-Vzl" customClass="NewsController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
474+ <view key="view" contentMode="scaleToFill" id="Kx5-cu-FC2">
475+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
627476 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
628477 <subviews>
629− <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="FSV-Pu-wlS">
630− <rect key="frame" x="0.0" y="0.0" width="375" height="323.5"/>
478+ <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="5IP-vK-phq">
479+ <rect key="frame" x="0.0" y="20" width="375" height="647"/>
631480 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
632481 </tableView>
633482 </subviews>
634483 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
635484 <constraints>
636− <constraint firstAttribute="trailing" secondItem="FSV-Pu-wlS" secondAttribute="trailing" id="8wp-yX-8TF"/>
637− <constraint firstItem="FSV-Pu-wlS" firstAttribute="leading" secondItem="mOG-nL-CRD" secondAttribute="leading" id="Hah-NN-nNj"/>
638− <constraint firstAttribute="bottom" secondItem="FSV-Pu-wlS" secondAttribute="bottom" id="PSp-HL-Xpi"/>
639− <constraint firstItem="FSV-Pu-wlS" firstAttribute="top" secondItem="mOG-nL-CRD" secondAttribute="top" id="piA-Z5-euY"/>
485+ <constraint firstItem="5IP-vK-phq" firstAttribute="top" secondItem="qGo-Sq-Oz2" secondAttribute="top" id="HvO-w8-yYd"/>
486+ <constraint firstItem="5IP-vK-phq" firstAttribute="leading" secondItem="qGo-Sq-Oz2" secondAttribute="leading" id="NTk-fa-llk"/>
487+ <constraint firstItem="qGo-Sq-Oz2" firstAttribute="bottom" secondItem="5IP-vK-phq" secondAttribute="bottom" id="mAj-tJ-R30"/>
488+ <constraint firstItem="qGo-Sq-Oz2" firstAttribute="trailing" secondItem="5IP-vK-phq" secondAttribute="trailing" id="pcE-yb-fxC"/>
640489 </constraints>
490+ <viewLayoutGuide key="safeArea" id="qGo-Sq-Oz2"/>
641491 </view>
642492 <connections>
643− <outlet property="tableView" destination="FSV-Pu-wlS" id="Ti9-HQ-24K"/>
493+ <outlet property="tableView" destination="5IP-vK-phq" id="EQe-eC-W7P"/>
644494 </connections>
645495 </viewController>
646− <placeholder placeholderIdentifier="IBFirstResponder" id="mMa-G9-Ygw" userLabel="First Responder" sceneMemberID="firstResponder"/>
496+ <placeholder placeholderIdentifier="IBFirstResponder" id="6Lk-UL-mQL" userLabel="First Responder" sceneMemberID="firstResponder"/>
647497 </objects>
648− <point key="canvasLocation" x="7643" y="-796"/>
498+ <point key="canvasLocation" x="5426" y="-235"/>
649499 </scene>
650500 </scenes>
651501 <resources>
GDproject/Controller/ News and channels/ChannelListController.swift+1−1
@@ -103,7 +103,7 @@ class ChannelListController: UITableViewController {
103103 onEditingModeBegins?(Model.Channels(people: [], name: "Untitled", tags: []),IndexPath(row: 1, section: 0))
104104 }
105105
106− static let generalChannel = Model.Channels(people: [], name: "General", tags: [])
106+ static let generalChannel = Model.Channels(people: [], name: "General", id: -1, tags: [])
107107
108108 var dataSource : [Model.Channels] = [ ChannelListController.generalChannel ]
109109
GDproject/Controller/ News and channels/NewsController.swift+1−1
@@ -88,7 +88,7 @@ class NewsController: UIViewController, UISearchControllerDelegate, UpdateableWi
8888 func decideWhatChannelDisplay(){
8989 switch type! {
9090 case .NEWS, .NONE:
91− if let channel = channel, let id = channel.id {
91+ if let channel = channel, let id = channel.id, id != -1 {
9292
9393 Model.getChannel(with: id) { [weak self] in
9494 self?.news.dataSourse = $0.posts
GDproject/Controller/ News and channels/NewsVC.swift+8−3
@@ -85,7 +85,7 @@ class NewsVC: UIViewController, UITableViewDelegate, UITableViewDataSource {
8585 }
8686 default:
8787 cell.onUserDisplay = { (id) in
88− print("tapped when profile is open already \(id)")
88+ print("tapped when profile is opened already \(id)")
8989 }
9090 }
9191
@@ -108,16 +108,21 @@ class NewsVC: UIViewController, UITableViewDelegate, UITableViewDataSource {
108108 return 100.0
109109 }
110110
111+ var prevLast = -1
112+
111113 func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)
112114 {
113− if indexPath.row == cellDataSourse.count - 1
115+ // pagination
116+ if indexPath.row == cellDataSourse.count - 1 && prevLast != indexPath.row
114117 {
115118 // check this!
116− Model.getLast(on: 10, from: dataSourse.last?.id ?? 0)
119+ Model.getLast(on: 10, from: dataSourse.last?.id )
117120 { [weak self] in
118121 self?.dataSourse.append(contentsOf: $0.posts)
119122 $0.users.forEach { self?.dictionary[$0.key] = $0.value }
120123 }
124+
125+ prevLast = indexPath.row
121126 }
122127 }
123128}
GDproject/Controller/Coordinators/ChannelsCoordinator.swift+24−51
@@ -27,13 +27,13 @@ class ChannelsCoordinator: BaseCoordinator{
2727
2828 let channels = storyboard.instantiateViewController(withIdentifier: channelListControllerId) as! ChannelListController
2929
30− channels.onChannelSelected = { [weak self]
30+ channels.onChannelSelected = { [unowned self]
3131 (channel) in
32− self?.navigationController?.pushViewController(self!.presentNewsController(with: channel), animated: true)
32+ self.navigationController?.pushViewController(self.presentNewsController(with: channel), animated: true)
3333 }
3434
3535 channels.onEditingModeBegins = { [unowned self] (channel, indexPath) in
36− let vc = self.presentEditingChannelController(with: channel)
36+ let vc = self.presentNewsController(with: channel)
3737 self.navigationController?.pushViewController(vc, animated: true)
3838 vc.tabBarController?.tabBar.isHidden = true
3939 }
@@ -42,60 +42,33 @@ class ChannelsCoordinator: BaseCoordinator{
4242 navigationController?.setViewControllers([channels, nc], animated: false)
4343 }
4444
45− func presentEditingChannelController(with channel: Model.Channels? = nil) -> PulleyViewController {
46−
47− let mainContentVC = storyboard.instantiateViewController(withIdentifier: newsController+"1") as! NewsController
48− let drawerContentVC = storyboard.instantiateViewController(withIdentifier: "DrawerContentViewController1")
49−
45+ func presentNewsController(with channel: Model.Channels? = nil) -> NewsController {
46+ let mainContentVC = storyboard.instantiateViewController(withIdentifier: newsController) as! NewsController
5047 mainContentVC.channel = channel
51− let pulleyDrawerVC = PulleyViewController(contentViewController: mainContentVC, drawerViewController: drawerContentVC)
52−
53− pulleyDrawerVC.initialDrawerPosition = .collapsed
5448
55− return pulleyDrawerVC
56− }
57−
58− func presentNewsController(with channel: Model.Channels? = nil) -> PulleyViewController {
59−
60− let mainContentVC = storyboard.instantiateViewController(withIdentifier: newsController) as! NewsController
61− let drawerContentVC = storyboard.instantiateViewController(withIdentifier: "DrawerContentViewController")
62−
63− mainContentVC.channel = channel
64− mainContentVC.news.onFullPost = {
65− [weak self] (type,post) in
49+ if channel == nil || channel?.id == -1 {
50+ mainContentVC.news.onFullPost = {
51+ [weak self] (type,post) in
52+
53+ let vc = self?.storyboard.instantiateViewController(withIdentifier: fullPostControllerId) as! FullPostController
54+ vc.type = type
55+ vc.post = post
56+ self?.navigationController!.pushViewController(vc, animated: true)
57+ }
6658
67− let vc = self?.storyboard.instantiateViewController(withIdentifier: fullPostControllerId) as! FullPostController
68− vc.type = type
69− vc.post = post
70− self?.navigationController!.pushViewController(vc, animated: true)
71− }
72−
73− mainContentVC.news.onChannelDidChange = {
74− [weak self, weak mainContentVC] (tuple) in print("hep")
75− switch mainContentVC!.news.type {
76− case .ANONYMOUS:
77− print("nothing to diplay")
78− // mainContentVC!.posts = tuple.1
79− //mainContentVC!.dictionary = tuple.0
80− default:
81− let vc = self!.presentNewsController()
82− (vc.primaryContentViewController as! NewsController).anonymousChannel = tuple
83− (vc.primaryContentViewController as! NewsController).type = .ANONYMOUS
84− self?.navigationController?.pushViewController(vc, animated: true)
59+ mainContentVC.news.onChannelDidChange = {
60+ print("anon with \($0.0.count) users")
8561 }
62+
63+ mainContentVC.changedChannelName = {
64+ [weak mainContentVC] (title) in mainContentVC?.navigationItem.title = title
65+ }
66+
67+ mainContentVC.navigationItem.rightBarButtonItems = [UIBarButtonItem(barButtonSystemItem: .compose, target: self, action: #selector(writePost(_:)))
68+ ]
8669 }
8770
88− let pulleyDrawerVC = PulleyViewController(contentViewController: mainContentVC, drawerViewController: drawerContentVC)
89−
90− pulleyDrawerVC.initialDrawerPosition = .collapsed
91− mainContentVC.changedChannelName = {
92− [weak pulleyDrawerVC] (title) in pulleyDrawerVC?.navigationItem.title = title
93− }
94−
95− pulleyDrawerVC.navigationItem.rightBarButtonItems = [UIBarButtonItem(barButtonSystemItem: .compose, target: self, action: #selector(writePost(_:)))
96− ]
97−
98− return pulleyDrawerVC
71+ return mainContentVC
9972 }
10073
10174 @objc private func writePost(_ barItem: UIBarButtonItem)