a lot of changes: still trying to embed coordinators. slowly modfiying channels. added empty card for editing channel

This commit is contained in:
Darya Rednikina 2019-03-20 15:31:14 +03:00
parent 9e6ff4894b
commit 32e1d267d1
6 changed files with 113 additions and 41 deletions

View File

@ -2,7 +2,7 @@ github "robb/Cartography"
github "ivanbruel/MarkdownKit"
github "roberthein/TinyConstraints"
github "macteo/Marklight"
github "ElaWorkshop/TagListView"
github "Alamofire/Alamofire" "5.0.0-beta.2"
github "whitesmith/WSTagsField"
github "ReactiveCocoa/ReactiveCocoa" ~> 8.0
github "ReactiveCocoa/ReactiveCocoa" ~> 8.0
github "52inc/Pulley"

View File

@ -63,6 +63,8 @@
12F3D6BE2241130000A69214 /* Result.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B7224112E800A69214 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12F3D6C02241130200A69214 /* ReactiveSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B5224112E000A69214 /* ReactiveSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12F3D6C22241130400A69214 /* ReactiveMapKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B3224112D600A69214 /* ReactiveMapKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12F3D6C92242645800A69214 /* Pulley.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6C72242644D00A69214 /* Pulley.framework */; };
12F3D6CA2242645800A69214 /* Pulley.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6C72242644D00A69214 /* Pulley.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -81,6 +83,7 @@
12F3D6C02241130200A69214 /* ReactiveSwift.framework in Embed Frameworks */,
12F3D6BC224112FD00A69214 /* ReactiveCocoa.framework in Embed Frameworks */,
123AD0E5223C1C4300326173 /* WSTagsField.framework in Embed Frameworks */,
12F3D6CA2242645800A69214 /* Pulley.framework in Embed Frameworks */,
12E36DC2221441E1006FCDD7 /* MarkdownKit.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
@ -137,6 +140,7 @@
12F3D6B5224112E000A69214 /* ReactiveSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveSwift.framework; path = Carthage/Build/iOS/ReactiveSwift.framework; sourceTree = "<group>"; };
12F3D6B7224112E800A69214 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/iOS/Result.framework; sourceTree = "<group>"; };
12F3D6B9224112F500A69214 /* ReactiveCocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveCocoa.framework; path = Carthage/Build/iOS/ReactiveCocoa.framework; sourceTree = "<group>"; };
12F3D6C72242644D00A69214 /* Pulley.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pulley.framework; path = Carthage/Build/iOS/Pulley.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -147,6 +151,7 @@
12E36DB522143D54006FCDD7 /* TinyConstraints.framework in Frameworks */,
12F3D6B4224112D600A69214 /* ReactiveMapKit.framework in Frameworks */,
124CC7052221C2BB009DF531 /* Alamofire.framework in Frameworks */,
12F3D6C92242645800A69214 /* Pulley.framework in Frameworks */,
12F3D6BB224112FD00A69214 /* ReactiveCocoa.framework in Frameworks */,
12F3D6B8224112E900A69214 /* Result.framework in Frameworks */,
12F3D6B6224112E100A69214 /* ReactiveSwift.framework in Frameworks */,
@ -199,6 +204,7 @@
12E36D8F221424EA006FCDD7 = {
isa = PBXGroup;
children = (
12F3D6C72242644D00A69214 /* Pulley.framework */,
12F3D6B9224112F500A69214 /* ReactiveCocoa.framework */,
12F3D6B7224112E800A69214 /* Result.framework */,
12F3D6B5224112E000A69214 /* ReactiveSwift.framework */,

View File

@ -416,6 +416,45 @@
</objects>
<point key="canvasLocation" x="3444" y="129.98500749625188"/>
</scene>
<!--Pulley View Controller-->
<scene sceneID="cBw-kf-fO5">
<objects>
<viewController id="IbM-Ix-dsI" customClass="PulleyViewController" customModule="Pulley" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="hBO-ys-jBX">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JAV-ei-FE9">
<rect key="frame" x="0.0" y="343.5" width="375" height="323.5"/>
<connections>
<segue destination="gBC-pa-4Y8" kind="embed" id="e5o-yX-vfJ"/>
</connections>
</containerView>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="KD4-lL-5lI">
<rect key="frame" x="0.0" y="20" width="375" height="323.5"/>
<connections>
<segue destination="sPi-8s-ya2" kind="embed" id="0dA-aV-epC"/>
</connections>
</containerView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="AM9-XR-Q11" firstAttribute="trailing" secondItem="JAV-ei-FE9" secondAttribute="trailing" id="0nc-wd-359"/>
<constraint firstItem="JAV-ei-FE9" firstAttribute="top" secondItem="KD4-lL-5lI" secondAttribute="bottom" id="2ap-xA-MZc"/>
<constraint firstItem="KD4-lL-5lI" firstAttribute="top" secondItem="AM9-XR-Q11" secondAttribute="top" id="57N-k9-3Da"/>
<constraint firstItem="KD4-lL-5lI" firstAttribute="leading" secondItem="AM9-XR-Q11" secondAttribute="leading" id="KS0-2b-0Zn"/>
<constraint firstItem="KD4-lL-5lI" firstAttribute="height" secondItem="JAV-ei-FE9" secondAttribute="height" id="W9b-Gn-1ZT"/>
<constraint firstItem="AM9-XR-Q11" firstAttribute="trailing" secondItem="KD4-lL-5lI" secondAttribute="trailing" id="bxO-FD-qi7"/>
<constraint firstItem="AM9-XR-Q11" firstAttribute="bottom" secondItem="JAV-ei-FE9" secondAttribute="bottom" id="eCt-RJ-W5F"/>
<constraint firstItem="JAV-ei-FE9" firstAttribute="leading" secondItem="AM9-XR-Q11" secondAttribute="leading" id="tJO-om-OjN"/>
</constraints>
<viewLayoutGuide key="safeArea" id="AM9-XR-Q11"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dJR-ry-ymY" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="5055.1999999999998" y="757.87106446776613"/>
</scene>
<!--Posts-->
<scene sceneID="RSd-UJ-34B">
<objects>
@ -432,26 +471,6 @@
</objects>
<point key="canvasLocation" x="1088.8" y="132.68365817091455"/>
</scene>
<!--News Controller-->
<scene sceneID="eR7-97-LRL">
<objects>
<tableViewController storyboardIdentifier="NewsController" id="Nqc-TI-ueQ" customClass="NewsController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="hwA-SE-xpS">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="sectionIndexBackgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="dataSource" destination="Nqc-TI-ueQ" id="bu5-tQ-7lb"/>
<outlet property="delegate" destination="Nqc-TI-ueQ" id="kTM-Be-8qb"/>
</connections>
</tableView>
<navigationItem key="navigationItem" largeTitleDisplayMode="always" id="b8E-6f-hLM"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="c9d-Kh-itI" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1880" y="136"/>
</scene>
<!--Profile-->
<scene sceneID="dJj-Hp-Wa9">
<objects>
@ -487,6 +506,49 @@
</objects>
<point key="canvasLocation" x="-466" y="641"/>
</scene>
<!--News Controller-->
<scene sceneID="6SA-L8-PwW">
<objects>
<viewController storyboardIdentifier="NewsController" id="sPi-8s-ya2" customClass="NewsController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Qwh-6O-iyN">
<rect key="frame" x="0.0" y="0.0" width="375" height="323.5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<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">
<rect key="frame" x="0.0" y="0.0" width="375" height="323.5"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottomMargin" secondItem="4pw-5n-XsC" secondAttribute="bottom" id="iji-Cm-2Xx"/>
<constraint firstItem="4pw-5n-XsC" firstAttribute="top" secondItem="Qwh-6O-iyN" secondAttribute="topMargin" id="j2B-b5-dg7"/>
<constraint firstItem="4pw-5n-XsC" firstAttribute="leading" secondItem="Qwh-6O-iyN" secondAttribute="leading" id="nau-1I-Bh7"/>
<constraint firstAttribute="trailing" secondItem="4pw-5n-XsC" secondAttribute="trailing" id="vnT-kX-h1h"/>
</constraints>
</view>
<connections>
<outlet property="tableView" destination="4pw-5n-XsC" id="usq-Vi-rXA"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="3Pe-af-1NZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="5890" y="482"/>
</scene>
<!--View Controller-->
<scene sceneID="LJw-Xf-aJT">
<objects>
<viewController storyboardIdentifier="DrawerContentViewController" id="gBC-pa-4Y8" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Z3E-He-aJI">
<rect key="frame" x="0.0" y="0.0" width="375" height="323.5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="KTe-P9-g8t" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="5888.8000000000002" y="999.40029985007504"/>
</scene>
</scenes>
<resources>
<image name="1" width="30" height="30"/>

View File

@ -21,8 +21,11 @@ protocol UpdateableWithUser: class {
}
// MARK:- Controller with posts and channels availiable.
// Search is availiable within every table (posts and channels). Has button-functionality for boths post and chnnels
class NewsController: UITableViewController, UISearchControllerDelegate, NewPostDelegate, UpdateableWithChannel, DataDelegate
class NewsController: UIViewController, UISearchControllerDelegate, NewPostDelegate, UpdateableWithChannel, DataDelegate
{
var changedChannelName: ((String)->())?
func passData(for row: Int, channel: Model.Channels) {
if channel.id == -1{
self.channel = nil
@ -31,6 +34,8 @@ class NewsController: UITableViewController, UISearchControllerDelegate, NewPost
}
}
@IBOutlet weak var tableView: UITableView!
var dictionary: [Int: Model.Users]? {
didSet {
@ -147,9 +152,8 @@ class NewsController: UITableViewController, UISearchControllerDelegate, NewPost
self?.posts = $0.posts
self?.dictionary = $0.users
self?.refreshContr.endRefreshing()
self?.navigationItem.title = "General"
self?.changedChannelName?("General")
}
}
}
@ -245,7 +249,7 @@ class NewsController: UITableViewController, UISearchControllerDelegate, NewPost
var isBannerVisible: Bool = false
override func scrollViewDidScroll(_ scrollView: UIScrollView) {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
print(scrollView.contentOffset.y)
if scrollView.contentOffset.y >= 50 && !isBannerVisible{
isBannerVisible = true

View File

@ -1,14 +0,0 @@
import UIKit
class TabbarCoordinator{
var window: UIWindow!
func start(){
let tabbar = UIStoryboard.tabBarController()
window.rootViewController = tabbar
}
init(window: UIWindow) {
self.window = window
}
}

View File

@ -8,6 +8,7 @@
import Foundation
import UIKit
import Pulley
class ChannelsCoordinator: BaseCoordinator{
private weak var navigationController: UINavigationController?
@ -22,7 +23,20 @@ class ChannelsCoordinator: BaseCoordinator{
private func show() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let channels = storyboard.instantiateViewController(withIdentifier: channelListControllerId) as! ChannelListController
navigationController?.setViewControllers([channels], animated: false)
let mainContentVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: newsController) as! NewsController
let drawerContentVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "DrawerContentViewController")
let pulleyDrawerVC = PulleyViewController(contentViewController: mainContentVC, drawerViewController: drawerContentVC)
pulleyDrawerVC.initialDrawerPosition = .collapsed
mainContentVC.changedChannelName = {
[weak pulleyDrawerVC] (title) in pulleyDrawerVC?.navigationItem.title = title
}
navigationController?.setViewControllers([channels,pulleyDrawerVC], animated: false)
}
}