git.iko.soy/dashared/GDproject
on master help sign in
started working on sticky headers and basic info in profile
commitcf2ae8bf5230a23746bb9522f395594405e11b61 authorDarya Rednikina <rednikina.com@yandex.ru> dateSat 16 Feb 2019, 16:56 (8 years ago) parent173e0db
9 files changed+270−25
GDproject.xcodeproj/project.pbxproj+8 GDproject/Base.lproj/Main.storyboard+13−12 GDproject/Constants.swift+2 GDproject/Controller/BasicInfoCell.swift+38 GDproject/Controller/BasicInfoController.swift+103 GDproject/Controller/News/HeaderNewsChannels.swift+50−7 GDproject/Controller/News/NewsController.swift+2 GDproject/Controller/News/NewsVC.swift+27−3 GDproject/Controller/ProfileViewController.swift+27−3
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+ 12DB7FD722181CD20096878E /* BasicInfoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12DB7FD622181CD20096878E /* BasicInfoController.swift */; };
14+ 12DB7FD922181E660096878E /* BasicInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12DB7FD822181E660096878E /* BasicInfoCell.swift */; };
1315 12E36D9C221424EA006FCDD7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36D9B221424EA006FCDD7 /* AppDelegate.swift */; };
1416 12E36D9E221424EA006FCDD7 /* NewsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36D9D221424EA006FCDD7 /* NewsController.swift */; };
1517 12E36DA1221424EA006FCDD7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 12E36D9F221424EA006FCDD7 /* Main.storyboard */; };
@@ -58,6 +60,8 @@
5860 125BD57C22171D2A008A3575 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
5961 125BD57E22171D73008A3575 /* Extentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extentions.swift; sourceTree = "<group>"; };
6062 125BD5802217314A008A3575 /* NewsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsVC.swift; sourceTree = "<group>"; };
63+ 12DB7FD622181CD20096878E /* BasicInfoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicInfoController.swift; sourceTree = "<group>"; };
64+ 12DB7FD822181E660096878E /* BasicInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicInfoCell.swift; sourceTree = "<group>"; };
6165 12E36D98221424EA006FCDD7 /* GDproject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GDproject.app; sourceTree = BUILT_PRODUCTS_DIR; };
6266 12E36D9B221424EA006FCDD7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
6367 12E36D9D221424EA006FCDD7 /* NewsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsController.swift; sourceTree = "<group>"; };
@@ -157,6 +161,8 @@
157161 isa = PBXGroup;
158162 children = (
159163 125BD57C22171D2A008A3575 /* ProfileViewController.swift */,
164+ 12DB7FD622181CD20096878E /* BasicInfoController.swift */,
165+ 12DB7FD822181E660096878E /* BasicInfoCell.swift */,
160166 12E36DD322156519006FCDD7 /* News */,
161167 );
162168 path = Controller;
@@ -267,7 +273,9 @@
267273 125BD57F22171D73008A3575 /* Extentions.swift in Sources */,
268274 12E36DD122148122006FCDD7 /* FullPostController.swift in Sources */,
269275 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */,
276+ 12DB7FD922181E660096878E /* BasicInfoCell.swift in Sources */,
270277 12E36D9C221424EA006FCDD7 /* AppDelegate.swift in Sources */,
278+ 12DB7FD722181CD20096878E /* BasicInfoController.swift in Sources */,
271279 12E36DCE22144756006FCDD7 /* Constants.swift in Sources */,
272280 );
273281 runOnlyForDeploymentPostprocessing = 0;
GDproject/Base.lproj/Main.storyboard+13−12
@@ -54,30 +54,30 @@
5454 <rect key="frame" x="0.0" y="116" width="375" height="502"/>
5555 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
5656 <view key="tableHeaderView" contentMode="scaleToFill" id="kFZ-3c-OFY">
57− <rect key="frame" x="0.0" y="0.0" width="375" height="200"/>
57+ <rect key="frame" x="0.0" y="0.0" width="375" height="162"/>
5858 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
5959 <subviews>
6060 <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"/>
61+ <rect key="frame" x="16" y="16" width="100" height="100"/>
6262 <constraints>
63− <constraint firstAttribute="width" constant="120" id="3Xq-K8-0jL"/>
64− <constraint firstAttribute="height" constant="120" id="d83-z4-p3p"/>
63+ <constraint firstAttribute="width" constant="100" id="3Xq-K8-0jL"/>
64+ <constraint firstAttribute="height" constant="100" id="d83-z4-p3p"/>
6565 </constraints>
6666 </imageView>
6767 <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"/>
68+ <rect key="frame" x="136" y="16" width="223" height="100"/>
6969 <subviews>
7070 <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"/>
71+ <rect key="frame" x="0.0" y="0.0" width="223" height="49"/>
7272 <subviews>
7373 <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"/>
74+ <rect key="frame" x="0.0" y="0.0" width="223" height="21.5"/>
7575 <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
7676 <nil key="textColor"/>
7777 <nil key="highlightedColor"/>
7878 </label>
7979 <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"/>
80+ <rect key="frame" x="0.0" y="29.5" width="223" height="19.5"/>
8181 <fontDescription key="fontDescription" type="system" pointSize="16"/>
8282 <nil key="textColor"/>
8383 <nil key="highlightedColor"/>
@@ -85,18 +85,18 @@
8585 </subviews>
8686 </stackView>
8787 <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"/>
88+ <rect key="frame" x="0.0" y="83" width="223" height="17"/>
8989 <fontDescription key="fontDescription" type="system" pointSize="14"/>
9090 <nil key="textColor"/>
9191 <nil key="highlightedColor"/>
9292 </label>
9393 </subviews>
9494 <constraints>
95− <constraint firstAttribute="height" constant="120" id="8vI-3o-mkr"/>
95+ <constraint firstAttribute="height" constant="100" id="8vI-3o-mkr"/>
9696 </constraints>
9797 </stackView>
9898 <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"/>
99+ <rect key="frame" x="16" y="124" width="343" height="30"/>
100100 <subviews>
101101 <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">
102102 <rect key="frame" x="0.0" y="0.0" width="35.5" height="30"/>
@@ -114,12 +114,12 @@
114114 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
115115 <constraints>
116116 <constraint firstItem="93Q-rB-JKk" firstAttribute="top" secondItem="kFZ-3c-OFY" secondAttribute="top" constant="16" id="5r9-SM-GHQ"/>
117+ <constraint firstAttribute="bottom" secondItem="hFb-Uj-GwE" secondAttribute="bottom" constant="8" id="Ccj-2e-nWu"/>
117118 <constraint firstItem="hFb-Uj-GwE" firstAttribute="leading" secondItem="kFZ-3c-OFY" secondAttribute="leading" constant="16" id="HWn-2I-NvS"/>
118119 <constraint firstAttribute="trailing" secondItem="hFb-Uj-GwE" secondAttribute="trailing" constant="16" id="MHn-bJ-vkd"/>
119120 <constraint firstItem="HD1-1N-Rae" firstAttribute="leading" secondItem="93Q-rB-JKk" secondAttribute="trailing" constant="20" id="Zmg-ZS-Eyy"/>
120121 <constraint firstItem="93Q-rB-JKk" firstAttribute="leading" secondItem="kFZ-3c-OFY" secondAttribute="leading" constant="16" id="f3K-RA-5qe"/>
121122 <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"/>
123123 <constraint firstItem="HD1-1N-Rae" firstAttribute="top" secondItem="kFZ-3c-OFY" secondAttribute="top" constant="16" id="zZe-Oe-Okw"/>
124124 </constraints>
125125 </view>
@@ -243,6 +243,7 @@
243243 <tabBarController automaticallyAdjustsScrollViewInsets="NO" id="IeP-4W-8LT" sceneMemberID="viewController">
244244 <toolbarItems/>
245245 <tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="3pl-mU-U30">
246+ <rect key="frame" x="0.0" y="0.0" width="1000" height="1000"/>
246247 <autoresizingMask key="autoresizingMask"/>
247248 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
248249 </tabBar>
GDproject/Constants.swift+2
@@ -12,3 +12,5 @@ let postCellId = "PostCell"
1212let headerNewsChannelsVC = "HeaderSegmentedControll"
1313// for transitioning to full post view
1414let fullPostControllerId = "FullPostController"
15+
16+let basicInfoCellId = "BasicInfoCell"
GDproject/Controller/BasicInfoCell.swiftnew file+38
@@ -0,0 +1,38 @@
1+//
2+// BasicInfoCell.swift
3+// NewsFeed
4+//
5+// Created by cstore on 23/01/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+import TinyConstraints
11+
12+class BasicInfoCell: UITableViewCell{
13+
14+ var titleLabel: UILabel = {
15+ let label = UILabel()
16+ label.font = UIFont.boldSystemFont(ofSize: 16)
17+ label.textColor = .black
18+ return label
19+ }()
20+
21+ override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
22+ super.init(style: style, reuseIdentifier: reuseIdentifier)
23+ }
24+
25+ func setUpView(){
26+ addSubview(titleLabel)
27+ titleLabel.edgesToSuperview(excluding: .bottom, insets: .top(8) + .left(16) + .right(16))
28+ }
29+
30+ required init?(coder aDecoder: NSCoder) {
31+ fatalError("init(coder:) has not been implemented")
32+ }
33+
34+ func fill(title: String){
35+ setUpView()
36+ titleLabel.text = title
37+ }
38+}
GDproject/Controller/BasicInfoController.swiftnew file+103
@@ -0,0 +1,103 @@
1+//
2+// BasicInfoController.swift
3+// GDproject
4+//
5+// Created by cstore on 16/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+struct CellData{
12+ var opened = Bool()
13+ var title = String()
14+ var sectionData = [String]()
15+}
16+
17+class BasicInfoController: UIViewController, UITableViewDelegate, UITableViewDataSource {
18+
19+ var dataSourse: [CellData] = [
20+ CellData(opened: false, title: "Phone", sectionData: ["+7 901 733 01 79"]),
21+ CellData(opened: false, title: "Mail", sectionData: ["vbogomazova@edu.hse.ru"]),
22+ CellData(opened: false, title: "Research ID", sectionData: ["4567834336789456737"]),
23+ CellData(opened: false, title: "Published", sectionData: ["Книга 1", "Книга 2", "Книга 3"]),
24+ CellData(opened: false, title: "Courses", sectionData: ["Курс 1", "Курс 2"]),
25+ CellData(opened: false, title: "Link", sectionData: ["https://wwww.hse.ru"])
26+ ]
27+
28+ var type: HeaderType = .BASIC_INFO("Profile", "Basic info")
29+
30+ var viewController: ProfileViewController?
31+
32+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
33+ if (dataSourse[section].opened){
34+ return dataSourse[section].sectionData.count + 1
35+ } else {
36+ return 1
37+ }
38+ }
39+
40+ func numberOfSections(in tableView: UITableView) -> Int {
41+ return dataSourse.count
42+ }
43+
44+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
45+ if indexPath.row == 0 {
46+ let cell = tableView.dequeueReusableCell(withIdentifier: basicInfoCellId, for: indexPath) as! BasicInfoCell
47+ cell.fill(title: dataSourse[indexPath.section].title)
48+ cell.selectionStyle = .none
49+ return cell
50+ } else {
51+ let cell = tableView.dequeueReusableCell(withIdentifier: basicInfoCellId, for: indexPath) as! BasicInfoCell
52+ cell.fill(title: dataSourse[indexPath.section].sectionData[indexPath.row - 1])
53+ cell.selectionStyle = .none
54+ return cell
55+ }
56+ }
57+
58+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
59+ if indexPath.row == 0 {
60+ if dataSourse[indexPath.section].opened {
61+ dataSourse[indexPath.section].opened = false
62+ let section = IndexSet.init(integer: indexPath.section)
63+ tableView.reloadSections(section, with: .none)
64+ } else {
65+ dataSourse[indexPath.section].opened = true
66+ let section = IndexSet.init(integer: indexPath.section)
67+ tableView.reloadSections(section, with: .none)
68+ }
69+ }
70+ }
71+ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
72+ return UITableView.automaticDimension
73+ }
74+
75+ func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
76+ return 100.0
77+ }
78+
79+ func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
80+ if section == 0 {
81+ return 46
82+ }
83+ return 0
84+ }
85+
86+ func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
87+ {
88+ if section == 0 {
89+ let cell = tableView.dequeueReusableCell(withIdentifier: headerNewsChannelsVC) as! HeaderNewsChannels
90+
91+ cell.vcProfile = viewController
92+
93+ cell.type = type
94+
95+ let view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 46.0))
96+ view.addSubview(cell)
97+ cell.edgesToSuperview()
98+
99+ return view
100+ }
101+ return nil
102+ }
103+}
GDproject/Controller/News/HeaderNewsChannels.swift+50−7
@@ -11,12 +11,35 @@ import TinyConstraints
1111
1212class HeaderNewsChannels: UITableViewCell {
1313
14+ weak var tableView: UITableView?
15+
1416 weak var vc: NewsController?
17+ weak var vcProfile: ProfileViewController?
18+
19+ var type: HeaderType = .PROFILE("Posts", "Channel")
20+ {
21+ didSet{
22+ switch type {
23+ case .PROFILE(let f, let s):
24+ postsChannelsSegment = UISegmentedControl(items: [f,s])
25+ postsChannelsSegment?.selectedSegmentIndex = 0
26+ case .BASIC_INFO(let b, let i):
27+ postsChannelsSegment = UISegmentedControl(items: [b,i])
28+ postsChannelsSegment?.selectedSegmentIndex = 1
29+ case .NEWS(let n, let bi):
30+ postsChannelsSegment = UISegmentedControl(items: [n, bi])
31+ postsChannelsSegment?.selectedSegmentIndex = 0
32+ default:
33+ break
34+ }
35+ setUpCell()
36+ }
37+ }
1538
1639 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
1740 super.init(style: style, reuseIdentifier: reuseIdentifier)
1841 backgroundColor = .white
19− setUpCell()
42+ //setUpCell()
2043 }
2144
2245 required init?(coder aDecoder: NSCoder) {
@@ -24,24 +47,44 @@ class HeaderNewsChannels: UITableViewCell {
2447 }
2548
2649 func setUpCell(){
50+
51+ guard let postsChannelsSegment = postsChannelsSegment else {
52+ return
53+ }
54+
2755 addSubview(postsChannelsSegment)
28− postsChannelsSegment.selectedSegmentIndex = 0
56+
2957 postsChannelsSegment.addTarget(self, action: #selector(changedValue), for: .valueChanged)
3058 postsChannelsSegment.edgesToSuperview(insets: .left(16) + .right(16) + .top(8) + .bottom(8))
3159 }
3260
3361 // Initialize
34− let postsChannelsSegment = UISegmentedControl(items: ["Posts", "Channels"])
62+ var postsChannelsSegment: UISegmentedControl?
3563
3664 @objc func changedValue(_ sender: UISegmentedControl) {
3765 let index = sender.selectedSegmentIndex
66+
3867 switch index {
3968 case 0:
40− print("posts")
41− vc?.setUpNavigationItemsforPosts()
69+ switch type {
70+ case .BASIC_INFO:
71+ vcProfile?.changeToPosts()
72+ case .NEWS:
73+ vc?.setUpNavigationItemsforPosts()
74+ default:
75+ break
76+ }
4277 case 1:
43− print("channels")
44− vc?.setUpNavigationItemsForChannels()
78+ switch type {
79+ case .PROFILE:
80+ print("info")
81+ vcProfile?.changeToBasicInfo()
82+ case .NEWS:
83+ print("channels")
84+ vc?.setUpNavigationItemsForChannels()
85+ default:
86+ break
87+ }
4588 default:
4689 break
4790 }
GDproject/Controller/News/NewsController.swift+2
@@ -32,6 +32,8 @@ class NewsController: UIViewController
3232 news.dataSourse = dataSourse
3333 news.viewController = self
3434
35+ news.type = .NEWS("Posts", "Channels")
36+
3537 tableView.delegate = news
3638 tableView.dataSource = news
3739 tableView.reloadData()
GDproject/Controller/News/NewsVC.swift+27−3
@@ -12,6 +12,8 @@ class NewsVC: UIViewController, UITableViewDelegate, UITableViewDataSource{
1212
1313 var dataSourse: [Post] = []
1414
15+ var type: HeaderType = .NONE
16+
1517 var viewController: UIViewController?
1618
1719 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
@@ -46,19 +48,41 @@ class NewsVC: UIViewController, UITableViewDelegate, UITableViewDataSource{
4648 }
4749
4850 func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
49− return 46.0
51+ switch type {
52+ case .NONE:
53+ return 0
54+ default:
55+ return 46
56+ }
5057 }
5158
5259 func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
5360 {
5461 let cell = tableView.dequeueReusableCell(withIdentifier: headerNewsChannelsVC) as! HeaderNewsChannels
55− //cell.vc = viewController as? NewsController
62+
63+ cell.vc = viewController as? NewsController
64+ cell.vcProfile = viewController as? ProfileViewController
65+
66+ cell.type = type
5667
5768 let view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 46.0))
5869 view.addSubview(cell)
5970 cell.edgesToSuperview()
6071
61− return view
72+ switch type {
73+ case .NONE:
74+ return nil
75+ default:
76+ return view
77+ }
6278 }
6379
6480}
81+
82+
83+enum HeaderType {
84+ case NONE
85+ case NEWS(String, String)
86+ case PROFILE(String, String)
87+ case BASIC_INFO(String, String)
88+}
GDproject/Controller/ProfileViewController.swift+27−3
@@ -7,6 +7,7 @@
77//
88
99import UIKit
10+import TinyConstraints
1011
1112class ProfileViewController: UIViewController {
1213
@@ -37,17 +38,28 @@ class ProfileViewController: UIViewController {
3738
3839 var user: User = User(surname: "Богомазова", name: "Вероника", optional: "Львовна", emailName: "vbogomazova", id: 2, place: "📍Москва, Кочновский пр. 3", faculty: "Методист: Факультет Компьютерных наук")
3940
40− //let basicInfo = BasicInfoTableViewController()
41+ let basicInfo = BasicInfoController()
4142 let posts = NewsVC()
4243
43− override func viewDidLoad() {
44+ override func viewDidLoad()
45+ {
4446 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. .")])]
47+
48+ posts.type = .PROFILE("Posts", "Basic Info")
49+
50+ 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. 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. .")])]
51+
52+ // basicInfo.dataSourse =
53+
54+ posts.viewController = self
55+ basicInfo.viewController = self
4656
4757 tableView.register(HeaderNewsChannels.self, forCellReuseIdentifier: headerNewsChannelsVC)
4858
4959 tableView.register(PostViewCell.self, forCellReuseIdentifier: postCellId)
5060
61+ tableView.register(BasicInfoCell.self, forCellReuseIdentifier: basicInfoCellId)
62+
5163 posts.viewController = self
5264
5365 fill(with: user)
@@ -93,4 +105,16 @@ class ProfileViewController: UIViewController {
93105
94106 self.present(optionMenu, animated: true, completion: nil)
95107 }
108+
109+ func changeToPosts(){
110+ tableView.delegate = posts
111+ tableView.dataSource = posts
112+ tableView.reloadData()
113+ }
114+
115+ func changeToBasicInfo(){
116+ tableView.delegate = basicInfo
117+ tableView.dataSource = basicInfo
118+ tableView.reloadData()
119+ }
96120}