git.iko.soy/dashared/GDproject
on master help sign in
created profile tab. needs great modifications and decomposition
commit173e0db7319c9771bc73196df6bee04f79937f96 authorDarya Rednikina <rednikina.com@yandex.ru> dateFri 15 Feb 2019, 23:58 (8 years ago) parentabe7a3a
16 files changed+435−95
GDproject.xcodeproj/project.pbxproj+18−6 GDproject/Base.lproj/Main.storyboard+154−7 GDproject/Controller/ChannelsController.swift−15 GDproject/Controller/News/ChannelsController.swift+35 GDproject/Controller/FullPostController.swift → GDproject/Controller/News/FullPostController.swift GDproject/Controller/HeaderNewsChannels.swift → GDproject/Controller/News/HeaderNewsChannels.swift−6 GDproject/Controller/NewPostViewController.swift → GDproject/Controller/News/NewPostViewController.swift GDproject/Controller/NewsController.swift → GDproject/Controller/News/NewsController.swift+16−58 GDproject/Controller/News/NewsVC.swift+64 GDproject/Controller/ProfileViewController.swift+96 GDproject/Extentions.swift+22 GDproject/Controller/MyStackView.swift → GDproject/MyStackView.swift GDproject/Simple model/Post.swift+7−1 GDproject/Simple model/User.swift+2−2 GDproject/Supporting files/Assets.xcassets/kitten.imageset/Contents.json+21 GDproject/Supporting files/Assets.xcassets/kitten.imageset/s1200-2.jpeg
GDproject.xcodeproj/project.pbxproj+18−6
@@ -7,6 +7,9 @@
77 objects = {
88
99/* Begin PBXBuildFile section */
10+ 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57C22171D2A008A3575 /* ProfileViewController.swift */; };
11+ 125BD57F22171D73008A3575 /* Extentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57E22171D73008A3575 /* Extentions.swift */; };
12+ 125BD5812217314A008A3575 /* NewsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD5802217314A008A3575 /* NewsVC.swift */; };
1013 12E36D9C221424EA006FCDD7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36D9B221424EA006FCDD7 /* AppDelegate.swift */; };
1114 12E36D9E221424EA006FCDD7 /* NewsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36D9D221424EA006FCDD7 /* NewsController.swift */; };
1215 12E36DA1221424EA006FCDD7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 12E36D9F221424EA006FCDD7 /* Main.storyboard */; };
@@ -52,6 +55,9 @@
5255/* End PBXCopyFilesBuildPhase section */
5356
5457/* Begin PBXFileReference section */
58+ 125BD57C22171D2A008A3575 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
59+ 125BD57E22171D73008A3575 /* Extentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extentions.swift; sourceTree = "<group>"; };
60+ 125BD5802217314A008A3575 /* NewsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsVC.swift; sourceTree = "<group>"; };
5561 12E36D98221424EA006FCDD7 /* GDproject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GDproject.app; sourceTree = BUILT_PRODUCTS_DIR; };
5662 12E36D9B221424EA006FCDD7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5763 12E36D9D221424EA006FCDD7 /* NewsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsController.swift; sourceTree = "<group>"; };
@@ -118,6 +124,8 @@
118124 children = (
119125 12E36DCF22145923006FCDD7 /* Controller */,
120126 12E36DCD22144756006FCDD7 /* Constants.swift */,
127+ 125BD57E22171D73008A3575 /* Extentions.swift */,
128+ 12E36DD422156559006FCDD7 /* MyStackView.swift */,
121129 12E36DBB2214402B006FCDD7 /* Supporting files */,
122130 12E36DBA2214401B006FCDD7 /* Simple model */,
123131 12E36D9F221424EA006FCDD7 /* Main.storyboard */,
@@ -148,13 +156,8 @@
148156 12E36DCF22145923006FCDD7 /* Controller */ = {
149157 isa = PBXGroup;
150158 children = (
151− 12E36DD422156559006FCDD7 /* MyStackView.swift */,
152− 12E36DD022148122006FCDD7 /* FullPostController.swift */,
153− 12E36DC522144266006FCDD7 /* HeaderNewsChannels.swift */,
154− 12E36DC722144374006FCDD7 /* ChannelsController.swift */,
155− 12E36D9D221424EA006FCDD7 /* NewsController.swift */,
159+ 125BD57C22171D2A008A3575 /* ProfileViewController.swift */,
156160 12E36DD322156519006FCDD7 /* News */,
157− 12E36DC922144635006FCDD7 /* NewPostViewController.swift */,
158161 );
159162 path = Controller;
160163 sourceTree = "<group>";
@@ -162,6 +165,12 @@
162165 12E36DD322156519006FCDD7 /* News */ = {
163166 isa = PBXGroup;
164167 children = (
168+ 12E36DC922144635006FCDD7 /* NewPostViewController.swift */,
169+ 12E36DD022148122006FCDD7 /* FullPostController.swift */,
170+ 12E36DC522144266006FCDD7 /* HeaderNewsChannels.swift */,
171+ 12E36DC722144374006FCDD7 /* ChannelsController.swift */,
172+ 12E36D9D221424EA006FCDD7 /* NewsController.swift */,
173+ 125BD5802217314A008A3575 /* NewsVC.swift */,
165174 12E36DCB22144725006FCDD7 /* PostViewCell.swift */,
166175 );
167176 path = News;
@@ -249,12 +258,15 @@
249258 12E36DD522156559006FCDD7 /* MyStackView.swift in Sources */,
250259 12E36DC822144374006FCDD7 /* ChannelsController.swift in Sources */,
251260 12E36DB922144016006FCDD7 /* User.swift in Sources */,
261+ 125BD5812217314A008A3575 /* NewsVC.swift in Sources */,
252262 12E36DB72214400A006FCDD7 /* Post.swift in Sources */,
253263 12E36DCA22144635006FCDD7 /* NewPostViewController.swift in Sources */,
254264 12E36D9E221424EA006FCDD7 /* NewsController.swift in Sources */,
255265 12E36DC622144266006FCDD7 /* HeaderNewsChannels.swift in Sources */,
256266 12E36DCC22144725006FCDD7 /* PostViewCell.swift in Sources */,
267+ 125BD57F22171D73008A3575 /* Extentions.swift in Sources */,
257268 12E36DD122148122006FCDD7 /* FullPostController.swift in Sources */,
269+ 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */,
258270 12E36D9C221424EA006FCDD7 /* AppDelegate.swift in Sources */,
259271 12E36DCE22144756006FCDD7 /* Constants.swift in Sources */,
260272 );
GDproject/Base.lproj/Main.storyboard+154−7
@@ -1,5 +1,5 @@
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" initialViewController="NuV-ZG-ld2">
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" initialViewController="IeP-4W-8LT">
33 <device id="retina4_7" orientation="portrait">
44 <adaptation id="fullscreen"/>
55 </device>
@@ -7,6 +7,7 @@
77 <deployment identifier="iOS"/>
88 <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
99 <capability name="Safe area layout guides" minToolsVersion="9.0"/>
10+ <capability name="Stack View standard spacing" minToolsVersion="9.0"/>
1011 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1112 </dependencies>
1213 <scenes>
@@ -19,7 +20,7 @@
1920 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2021 <subviews>
2122 <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="bdn-EE-6KU">
22− <rect key="frame" x="0.0" y="116" width="375" height="551"/>
23+ <rect key="frame" x="0.0" y="116" width="375" height="502"/>
2324 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
2425 </tableView>
2526 </subviews>
@@ -39,7 +40,115 @@
3940 </viewController>
4041 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
4142 </objects>
42− <point key="canvasLocation" x="1076" y="132.68365817091455"/>
43+ <point key="canvasLocation" x="2015.2" y="132.68365817091455"/>
44+ </scene>
45+ <!--Profile View Controller-->
46+ <scene sceneID="rQ6-TM-V7T">
47+ <objects>
48+ <viewController storyboardIdentifier="ProfileViewController" id="R4D-Ao-uvG" customClass="ProfileViewController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
49+ <view key="view" contentMode="scaleToFill" id="N0n-wL-Y5j">
50+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
51+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
52+ <subviews>
53+ <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="cay-ea-rTl">
54+ <rect key="frame" x="0.0" y="116" width="375" height="502"/>
55+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
56+ <view key="tableHeaderView" contentMode="scaleToFill" id="kFZ-3c-OFY">
57+ <rect key="frame" x="0.0" y="0.0" width="375" height="200"/>
58+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
59+ <subviews>
60+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="93Q-rB-JKk">
61+ <rect key="frame" x="16" y="16" width="120" height="120"/>
62+ <constraints>
63+ <constraint firstAttribute="width" constant="120" id="3Xq-K8-0jL"/>
64+ <constraint firstAttribute="height" constant="120" id="d83-z4-p3p"/>
65+ </constraints>
66+ </imageView>
67+ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="HD1-1N-Rae">
68+ <rect key="frame" x="156" y="16" width="203" height="120"/>
69+ <subviews>
70+ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="OJ4-19-keW">
71+ <rect key="frame" x="0.0" y="0.0" width="203" height="49"/>
72+ <subviews>
73+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vff-nz-u6X">
74+ <rect key="frame" x="0.0" y="0.0" width="203" height="21.5"/>
75+ <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
76+ <nil key="textColor"/>
77+ <nil key="highlightedColor"/>
78+ </label>
79+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="umX-IO-ePK">
80+ <rect key="frame" x="0.0" y="29.5" width="203" height="19.5"/>
81+ <fontDescription key="fontDescription" type="system" pointSize="16"/>
82+ <nil key="textColor"/>
83+ <nil key="highlightedColor"/>
84+ </label>
85+ </subviews>
86+ </stackView>
87+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ypY-U6-bJm">
88+ <rect key="frame" x="0.0" y="103" width="203" height="17"/>
89+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
90+ <nil key="textColor"/>
91+ <nil key="highlightedColor"/>
92+ </label>
93+ </subviews>
94+ <constraints>
95+ <constraint firstAttribute="height" constant="120" id="8vI-3o-mkr"/>
96+ </constraints>
97+ </stackView>
98+ <stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="hFb-Uj-GwE">
99+ <rect key="frame" x="16" y="154" width="343" height="30"/>
100+ <subviews>
101+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vCL-BI-I2h">
102+ <rect key="frame" x="0.0" y="0.0" width="35.5" height="30"/>
103+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
104+ <nil key="textColor"/>
105+ <nil key="highlightedColor"/>
106+ </label>
107+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yir-N6-Q6f">
108+ <rect key="frame" x="297" y="0.0" width="46" height="30"/>
109+ <state key="normal" title="Button"/>
110+ </button>
111+ </subviews>
112+ </stackView>
113+ </subviews>
114+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
115+ <constraints>
116+ <constraint firstItem="93Q-rB-JKk" firstAttribute="top" secondItem="kFZ-3c-OFY" secondAttribute="top" constant="16" id="5r9-SM-GHQ"/>
117+ <constraint firstItem="hFb-Uj-GwE" firstAttribute="leading" secondItem="kFZ-3c-OFY" secondAttribute="leading" constant="16" id="HWn-2I-NvS"/>
118+ <constraint firstAttribute="trailing" secondItem="hFb-Uj-GwE" secondAttribute="trailing" constant="16" id="MHn-bJ-vkd"/>
119+ <constraint firstItem="HD1-1N-Rae" firstAttribute="leading" secondItem="93Q-rB-JKk" secondAttribute="trailing" constant="20" id="Zmg-ZS-Eyy"/>
120+ <constraint firstItem="93Q-rB-JKk" firstAttribute="leading" secondItem="kFZ-3c-OFY" secondAttribute="leading" constant="16" id="f3K-RA-5qe"/>
121+ <constraint firstAttribute="trailing" secondItem="HD1-1N-Rae" secondAttribute="trailing" constant="16" id="qT1-ct-8ed"/>
122+ <constraint firstAttribute="bottom" secondItem="hFb-Uj-GwE" secondAttribute="bottom" constant="16" id="ucS-yd-kWf"/>
123+ <constraint firstItem="HD1-1N-Rae" firstAttribute="top" secondItem="kFZ-3c-OFY" secondAttribute="top" constant="16" id="zZe-Oe-Okw"/>
124+ </constraints>
125+ </view>
126+ </tableView>
127+ </subviews>
128+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
129+ <constraints>
130+ <constraint firstItem="cay-ea-rTl" firstAttribute="leading" secondItem="HGw-oo-OLI" secondAttribute="leading" id="37r-TE-87A"/>
131+ <constraint firstItem="HGw-oo-OLI" firstAttribute="trailing" secondItem="cay-ea-rTl" secondAttribute="trailing" id="LF0-J4-EyT"/>
132+ <constraint firstItem="cay-ea-rTl" firstAttribute="top" secondItem="HGw-oo-OLI" secondAttribute="top" id="Me6-du-vNl"/>
133+ <constraint firstItem="HGw-oo-OLI" firstAttribute="bottom" secondItem="cay-ea-rTl" secondAttribute="bottom" id="YBy-bu-FUY"/>
134+ </constraints>
135+ <viewLayoutGuide key="safeArea" id="HGw-oo-OLI"/>
136+ </view>
137+ <navigationItem key="navigationItem" id="jN7-hp-Zl8"/>
138+ <connections>
139+ <outlet property="facultyLabel" destination="ypY-U6-bJm" id="88V-uI-Rt8"/>
140+ <outlet property="nameLabel" destination="umX-IO-ePK" id="bY9-BV-XG2"/>
141+ <outlet property="newMessageButton" destination="yir-N6-Q6f" id="B3W-6Z-FLK"/>
142+ <outlet property="placeLabel" destination="vCL-BI-I2h" id="r5C-RE-QOe"/>
143+ <outlet property="profileImageView" destination="93Q-rB-JKk" id="Q3z-aT-aGK"/>
144+ <outlet property="profileView" destination="kFZ-3c-OFY" id="aJd-83-7kt"/>
145+ <outlet property="surnameLabel" destination="vff-nz-u6X" id="je2-H8-N6i"/>
146+ <outlet property="tableView" destination="cay-ea-rTl" id="RlG-PF-8DP"/>
147+ </connections>
148+ </viewController>
149+ <placeholder placeholderIdentifier="IBFirstResponder" id="sap-zV-B7l" userLabel="First Responder" sceneMemberID="firstResponder"/>
150+ </objects>
151+ <point key="canvasLocation" x="2013.5999999999999" y="957.57121439280365"/>
43152 </scene>
44153 <!--New Post View Controller-->
45154 <scene sceneID="TVK-xu-UdJ">
@@ -70,7 +179,7 @@
70179 </viewController>
71180 <placeholder placeholderIdentifier="IBFirstResponder" id="3fd-7N-vPg" userLabel="First Responder" sceneMemberID="firstResponder"/>
72181 </objects>
73− <point key="canvasLocation" x="1773" y="132"/>
182+ <point key="canvasLocation" x="2711.1999999999998" y="131.78410794602701"/>
74183 </scene>
75184 <!--Full Post Controller-->
76185 <scene sceneID="nNH-1Q-jks">
@@ -88,12 +197,13 @@
88197 </tableViewController>
89198 <placeholder placeholderIdentifier="IBFirstResponder" id="CP8-RO-wn0" userLabel="First Responder" sceneMemberID="firstResponder"/>
90199 </objects>
91− <point key="canvasLocation" x="2506" y="130"/>
200+ <point key="canvasLocation" x="3444" y="129.98500749625188"/>
92201 </scene>
93− <!--Navigation Controller-->
202+ <!--Posts-->
94203 <scene sceneID="RSd-UJ-34B">
95204 <objects>
96205 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="NuV-ZG-ld2" sceneMemberID="viewController">
206+ <tabBarItem key="tabBarItem" title="Posts" id="dH2-sL-YsR"/>
97207 <toolbarItems/>
98208 <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="6qB-3A-tuL">
99209 <rect key="frame" x="0.0" y="20" width="375" height="96"/>
@@ -106,7 +216,44 @@
106216 </navigationController>
107217 <placeholder placeholderIdentifier="IBFirstResponder" id="POV-5T-jeQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
108218 </objects>
109− <point key="canvasLocation" x="150" y="133"/>
219+ <point key="canvasLocation" x="1088.8" y="132.68365817091455"/>
220+ </scene>
221+ <!--Profile-->
222+ <scene sceneID="dJj-Hp-Wa9">
223+ <objects>
224+ <navigationController automaticallyAdjustsScrollViewInsets="NO" id="tae-5q-wvT" sceneMemberID="viewController">
225+ <tabBarItem key="tabBarItem" title="Profile" id="lYy-LQ-AcR"/>
226+ <toolbarItems/>
227+ <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="q3a-ph-c8V">
228+ <rect key="frame" x="0.0" y="20" width="375" height="96"/>
229+ <autoresizingMask key="autoresizingMask"/>
230+ </navigationBar>
231+ <nil name="viewControllers"/>
232+ <connections>
233+ <segue destination="R4D-Ao-uvG" kind="relationship" relationship="rootViewController" id="aF6-zK-hCB"/>
234+ </connections>
235+ </navigationController>
236+ <placeholder placeholderIdentifier="IBFirstResponder" id="Fvm-qf-2Ve" userLabel="First Responder" sceneMemberID="firstResponder"/>
237+ </objects>
238+ <point key="canvasLocation" x="1089" y="958"/>
239+ </scene>
240+ <!--Tab Bar Controller-->
241+ <scene sceneID="HCR-WO-p7g">
242+ <objects>
243+ <tabBarController automaticallyAdjustsScrollViewInsets="NO" id="IeP-4W-8LT" sceneMemberID="viewController">
244+ <toolbarItems/>
245+ <tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="3pl-mU-U30">
246+ <autoresizingMask key="autoresizingMask"/>
247+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
248+ </tabBar>
249+ <connections>
250+ <segue destination="NuV-ZG-ld2" kind="relationship" relationship="viewControllers" id="XuX-8s-fZU"/>
251+ <segue destination="tae-5q-wvT" kind="relationship" relationship="viewControllers" id="wCJ-4N-lfC"/>
252+ </connections>
253+ </tabBarController>
254+ <placeholder placeholderIdentifier="IBFirstResponder" id="gcF-2V-bfC" userLabel="First Responder" sceneMemberID="firstResponder"/>
255+ </objects>
256+ <point key="canvasLocation" x="-466" y="641"/>
110257 </scene>
111258 </scenes>
112259</document>
GDproject/Controller/ChannelsController.swiftdeleted−15
@@ -1,15 +0,0 @@
1−//
2−// PostTable.swift
3−// GDproject
4−//
5−// Created by cstore on 13/02/2019.
6−// Copyright © 2019 drHSE. All rights reserved.
7−//
8−
9−import UIKit
10−
11−class ChannelsController: UITableViewController {
12−
13−
14−
15−}
GDproject/Controller/News/ChannelsController.swiftnew file+35
@@ -0,0 +1,35 @@
1+//
2+// PostTable.swift
3+// GDproject
4+//
5+// Created by cstore on 13/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class ChannelsController: UITableViewController {
12+
13+ override func viewDidLoad() {
14+ super.viewDidLoad()
15+
16+ // Uncomment the following line to preserve selection between presentations
17+ // self.clearsSelectionOnViewWillAppear = false
18+
19+ // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
20+ // self.navigationItem.rightBarButtonItem = self.editButtonItem
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+}
GDproject/Controller/FullPostController.swift → GDproject/Controller/News/FullPostController.swiftrenamed

The content is the same.

GDproject/Controller/HeaderNewsChannels.swift → GDproject/Controller/News/HeaderNewsChannels.swiftrenamed−6
@@ -11,11 +11,8 @@ import TinyConstraints
1111
1212class HeaderNewsChannels: UITableViewCell {
1313
14− weak var tableView: UITableView?
1514 weak var vc: NewsController?
1615
17− let basicInfo = ChannelsController()
18−
1916 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
2017 super.init(style: style, reuseIdentifier: reuseIdentifier)
2118 backgroundColor = .white
@@ -45,9 +42,6 @@ class HeaderNewsChannels: UITableViewCell {
4542 case 1:
4643 print("channels")
4744 vc?.setUpNavigationItemsForChannels()
48−// self.tableView?.delegate = basicInfo
49−// self.tableView?.dataSource = basicInfo
50−// tableView?.reloadData()
5145 default:
5246 break
5347 }
GDproject/Controller/NewPostViewController.swift → GDproject/Controller/News/NewPostViewController.swiftrenamed

The content is the same.

GDproject/Controller/NewsController.swift → GDproject/Controller/News/NewsController.swiftrenamed+16−58
@@ -20,16 +20,24 @@ class NewsController: UIViewController
2020
2121 var dataSourse: [Post] = [Post(dataArray: [.text("Le Lorem Ipsum est simplement du faux texte employé dans la composition et la mise en page avant impression. Le Lorem Ipsum est le faux texte standard de l'imprimerie depuis les années 1500, quand un imprimeur anonyme assembla ensemble des morceaux de texte pour réaliser un livre spécimen de polices de texte. Il n'a pas fait que survivre cinq siècles, mais s'est aussi adapté à la bureautique informatique, sans que son contenu n'en soit modifié. Il a été popularisé dans les années 1960 grâce à la vente de feuilles Letraset contenant des passages du Lorem Ipsum, et, plus récemment, par son inclusion dans des applications de mise en page de texte, comme Aldus PageMaker. \n On sait depuis longtemps que travailler avec du texte lisible et contenant du sens est source de distractions, et empêche de se concentrer sur la mise en page elle-même. L'avantage du Lorem Ipsum sur un texte générique comme 'Du texte. Du texte. Du texte.' est qu'il possède une distribution de lettres plus ou moins normale, et en tout cas comparable avec celle du français standard. De nombreuses suites logicielles de mise en page ou éditeurs de sites Web ont fait du Lorem Ipsum leur faux texte par défaut, et une recherche pour 'Lorem Ipsum' vous conduira vers de nombreux sites qui n'en sont encore qu'à leur phase de construction. Plusieurs versions sont apparues avec le temps, parfois par accident, souvent intentionnellement (histoire d'y rajouter de petits clins d'oeil, voire des phrases embarassantes).")], from: User(name: "vbogomazova", id: 2, fullName: "Богомазова Вероника Львовна"), date: "14.02.19 в 12:05")]
2222
23+ var news = NewsVC()
24+ var channels = ChannelsController()
25+
2326 override func viewDidLoad()
2427 {
2528 super.viewDidLoad()
2629 tableView.register(HeaderNewsChannels.self, forCellReuseIdentifier: headerNewsChannelsVC)
2730 tableView.register(PostViewCell.self, forCellReuseIdentifier: postCellId)
2831
29− tableView.delegate = self
30− tableView.dataSource = self
32+ news.dataSourse = dataSourse
33+ news.viewController = self
34+
35+ tableView.delegate = news
36+ tableView.dataSource = news
3137 tableView.reloadData()
3238
39+
40+
3341 setUpNavigationItemsforPosts()
3442 searchController.searchBar.placeholder = "Search anything"
3543
@@ -47,11 +55,17 @@ class NewsController: UIViewController
4755 func setUpNavigationItemsforPosts(){
4856 navigationItem.title = "Posts"
4957 navigationItem.rightBarButtonItems = [UIBarButtonItem(barButtonSystemItem: .compose, target: self, action: #selector(self.writePost(_:)))]
58+ tableView.delegate = news
59+ tableView.dataSource = news
60+ tableView.reloadData()
5061 }
5162
5263 func setUpNavigationItemsForChannels(){
5364 navigationItem.title = "Channels"
5465 navigationItem.rightBarButtonItems = [UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(addChannel))]
66+ tableView.delegate = channels
67+ tableView.dataSource = channels
68+ tableView.reloadData()
5569 }
5670
5771 @objc func writePost(_ barItem: UIBarButtonItem)
@@ -146,59 +160,3 @@ class NewsController: UIViewController
146160 }
147161 }
148162}
149−
150−// MARK:- tableView delegate
151−extension NewsController: UITableViewDelegate{
152− func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
153− {
154− tableView.deselectRow(at: indexPath, animated: true)
155−
156− let vc = storyboard!.instantiateViewController(withIdentifier: fullPostControllerId) as! FullPostController
157−
158− vc.post = dataSourse[indexPath.row]
159− navigationController!.pushViewController(vc, animated: true)
160− }
161−}
162−
163−// MARK:- tableView dataSourse
164−extension NewsController: UITableViewDataSource
165−{
166− func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
167− return dataSourse.count
168− }
169−
170− func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
171− {
172− let cell = tableView.dequeueReusableCell(withIdentifier: postCellId, for: indexPath) as! PostViewCell
173−
174− cell.fill(with: dataSourse[indexPath.row].dataArray, false)
175− cell.selectionStyle = .none
176− return cell
177− }
178−
179− func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
180− return UITableView.automaticDimension
181− }
182−
183− func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
184− return 100.0
185− }
186−
187− func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
188− return 46.0
189− }
190−
191− func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
192− {
193− let cell = tableView.dequeueReusableCell(withIdentifier: headerNewsChannelsVC) as! HeaderNewsChannels
194− cell.vc = self
195−
196− let view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 46.0))
197− view.addSubview(cell)
198− cell.edgesToSuperview()
199−
200− return view
201− }
202−
203−
204−}
GDproject/Controller/News/NewsVC.swiftnew file+64
@@ -0,0 +1,64 @@
1+//
2+// NewsVC.swift
3+// GDproject
4+//
5+// Created by cstore on 15/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class NewsVC: UIViewController, UITableViewDelegate, UITableViewDataSource{
12+
13+ var dataSourse: [Post] = []
14+
15+ var viewController: UIViewController?
16+
17+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
18+ {
19+ tableView.deselectRow(at: indexPath, animated: true)
20+
21+ let vc = viewController!.storyboard!.instantiateViewController(withIdentifier: fullPostControllerId) as! FullPostController
22+
23+ vc.post = dataSourse[indexPath.row]
24+ viewController!.navigationController!.pushViewController(vc, animated: true)
25+ }
26+
27+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
28+ return dataSourse.count
29+ }
30+
31+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
32+ {
33+ let cell = tableView.dequeueReusableCell(withIdentifier: postCellId, for: indexPath) as! PostViewCell
34+
35+ cell.fill(with: dataSourse[indexPath.row].dataArray, false)
36+ cell.selectionStyle = .none
37+ return cell
38+ }
39+
40+ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
41+ return UITableView.automaticDimension
42+ }
43+
44+ func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
45+ return 100.0
46+ }
47+
48+ func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
49+ return 46.0
50+ }
51+
52+ func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
53+ {
54+ let cell = tableView.dequeueReusableCell(withIdentifier: headerNewsChannelsVC) as! HeaderNewsChannels
55+ //cell.vc = viewController as? NewsController
56+
57+ let view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 46.0))
58+ view.addSubview(cell)
59+ cell.edgesToSuperview()
60+
61+ return view
62+ }
63+
64+}
GDproject/Controller/ProfileViewController.swiftnew file+96
@@ -0,0 +1,96 @@
1+//
2+// ProfileViewController.swift
3+// GDproject
4+//
5+// Created by cstore on 15/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class ProfileViewController: UIViewController {
12+
13+ @IBOutlet weak var profileView: UIView!
14+
15+ @IBOutlet weak var tableView: UITableView!
16+
17+ @IBOutlet weak var profileImageView: UIImageView!
18+
19+ @IBOutlet weak var surnameLabel: UILabel!
20+
21+ @IBOutlet weak var nameLabel: UILabel!
22+
23+ @IBOutlet weak var facultyLabel: UILabel!
24+
25+ @IBOutlet weak var placeLabel: UILabel!
26+
27+ @IBOutlet weak var newMessageButton: UIButton!
28+
29+
30+ func fill(with user: User){
31+ self.facultyLabel.text = user.faculty ?? ""
32+ self.nameLabel.text = "\(user.initials.name) \(user.initials.optional ?? "")"
33+ self.surnameLabel.text = user.initials.surname
34+ self.profileImageView.image = #imageLiteral(resourceName: "kitten").roundedImage
35+ self.placeLabel.text = user.placeOfWork
36+ }
37+
38+ var user: User = User(surname: "Богомазова", name: "Вероника", optional: "Львовна", emailName: "vbogomazova", id: 2, place: "📍Москва, Кочновский пр. 3", faculty: "Методист: Факультет Компьютерных наук")
39+
40+ //let basicInfo = BasicInfoTableViewController()
41+ let posts = NewsVC()
42+
43+ override func viewDidLoad() {
44+ super.viewDidLoad()
45+ posts.dataSourse = [Post(dataArray: [.text("Le Lorem Ipsum est simplement du faux texte employé dans la composition et la mise en page avant impression. Le Lorem Ipsum est le faux texte standard de l'imprimerie depuis les années 1500, quand un imprimeur anonyme assembla ensemble des morceaux de texte pour réaliser un livre spécimen de polices de texte. Il n'a pas fait que survivre cinq siècles, mais s'est aussi adapté à la bureautique informatique, sans que son contenu n'en soit modifié. Il a été popularisé dans les années 1960 grâce à la vente de feuilles Letraset contenant des passages du Lorem Ipsum, et, plus récemment, par son inclusion dans des applications de mise en page de texte, comme Aldus PageMaker. est qu'il possède une distribution de lettres plus ou moins normale, et en tout cas comparable avec celle du français standard. De nombreuses suites logicielles de mise en page ou éditeurs de sites Web ont fait du Lorem Ipsum leur faux texte par défaut, et une recherche pour 'Lorem Ipsum' vous conduira vers de nombreux sites qui n'en sont encore qu'à leur phase de construction. Plusieurs versions sont apparues avec le temps, parfois par accident, souvent intentionnellement (histoire d'y rajouter de petits clins d'oeil, voire des phrases embarassantes).")]), Post(dataArray: [.text("Il n'a pas fait que survivre cinq siècles, mais s'est aussi adapté à la bureautique informatique, sans que son contenu n'en soit modifié. Il a été popularisé dans les années 1960 grâce à la vente de feuilles Letraset contenant des passages du Lorem Ipsum, et, plus récemment, par son inclusion dans des applications de mise en page de texte, comme Aldus PageMaker. .")])]
46+
47+ tableView.register(HeaderNewsChannels.self, forCellReuseIdentifier: headerNewsChannelsVC)
48+
49+ tableView.register(PostViewCell.self, forCellReuseIdentifier: postCellId)
50+
51+ posts.viewController = self
52+
53+ fill(with: user)
54+ tableView.delegate = posts
55+ tableView.dataSource = posts
56+ tableView.reloadData()
57+ }
58+
59+ override func viewWillAppear(_ animated: Bool) {
60+ setUpNavigarionBar()
61+ }
62+
63+ func setUpNavigarionBar(){
64+ navigationController?.navigationBar.prefersLargeTitles = true
65+ navigationItem.title = user.login
66+ let uibarbutton = UIBarButtonItem(title: "More", style: .plain, target: self, action: #selector(showInformation))
67+ navigationItem.rightBarButtonItems = [uibarbutton]
68+ navigationItem.largeTitleDisplayMode = .always
69+ }
70+
71+
72+ let copyLink: UIAlertAction = {
73+ let b = UIAlertAction(title: "Copy link", style: .default)
74+ return b
75+ }()
76+
77+ @objc func showInformation(){
78+
79+ // drafts
80+ // saved
81+
82+ let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
83+ let editAction = UIAlertAction(title: "Edit profile", style: .default)
84+ let settingsAction = UIAlertAction(title: "Settings", style: .default)
85+ let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
86+ let shareAction = UIAlertAction(title: "Share", style: .default)
87+
88+ optionMenu.addAction(editAction)
89+ optionMenu.addAction(settingsAction)
90+ optionMenu.addAction(copyLink)
91+ optionMenu.addAction(shareAction)
92+ optionMenu.addAction(cancelAction)
93+
94+ self.present(optionMenu, animated: true, completion: nil)
95+ }
96+}
GDproject/Extentions.swiftnew file+22
@@ -0,0 +1,22 @@
1+//
2+// Extentions.swift
3+// GDproject
4+//
5+// Created by cstore on 15/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+extension UIImage{
12+ var roundedImage: UIImage {
13+ let rect = CGRect(origin:CGPoint(x: 0, y: 0), size: self.size)
14+ UIGraphicsBeginImageContextWithOptions(self.size, false, 1)
15+ UIBezierPath(
16+ roundedRect: rect,
17+ cornerRadius: self.size.height
18+ ).addClip()
19+ self.draw(in: rect)
20+ return UIGraphicsGetImageFromCurrentImageContext()!
21+ }
22+}
GDproject/Controller/MyStackView.swift → GDproject/MyStackView.swiftrenamed

The content is the same.

GDproject/Simple model/Post.swift+7−1
@@ -13,7 +13,7 @@ struct Post {
1313 var dataArray: [Media]
1414 var fromUser: User
1515 var atDate: String
16− var comments: [Comment]
16+ var comments: [Comment] = []
1717 var hashtags: [String] = ["ФКН", "Подбельский", "НИУВШЭ", "Шершаков", "ПАД", "Интересное","Мемы","Забавное","Учеба","Наука"]
1818
1919 init(dataArray: [Media], from: User, date: String, comments: [Comment] = [])
@@ -23,6 +23,12 @@ struct Post {
2323 atDate = date
2424 self.comments = comments
2525 }
26+
27+ init(dataArray: [Media]) {
28+ self.dataArray = dataArray
29+ fromUser = User(name: "vbogomazova", id: 2, fullName: "Богомазова Вероника Львовна")
30+ atDate = "23.03.19 в 23:33"
31+ }
2632}
2733
2834
GDproject/Simple model/User.swift+2−2
@@ -13,11 +13,11 @@ struct User {
1313 //var photo: UIImage? = #imageLiteral(resourceName: "image")
1414 var login: String
1515 var id: Int
16− var surname: String?
1716 var fullName: String
18− var initials: (surname: String, name: String, optional: String?)?
17+ var initials: (surname: String, name: String, optional: String?) = ("Богомазова","Вероника","Львовна")
1918 var placeOfWork: String?
2019 var faculty: String?
20+ let posts: [Post] = []
2121
2222 init(name: String, id: Int, fullName: String) {
2323 self.login = name
GDproject/Supporting files/Assets.xcassets/kitten.imageset/Contents.jsonnew file+21
@@ -0,0 +1,21 @@
1+{
2+ "images" : [
3+ {
4+ "idiom" : "universal",
5+ "filename" : "s1200-2.jpeg",
6+ "scale" : "1x"
7+ },
8+ {
9+ "idiom" : "universal",
10+ "scale" : "2x"
11+ },
12+ {
13+ "idiom" : "universal",
14+ "scale" : "3x"
15+ }
16+ ],
17+ "info" : {
18+ "version" : 1,
19+ "author" : "xcode"
20+ }
21+}
GDproject/Supporting files/Assets.xcassets/kitten.imageset/s1200-2.jpegnew file

Binary file not shown.