@@ -7,6 +7,7 @@
77//
88
99import UIKit
10+import TinyConstraints
1011
1112class FullPostController: UITableViewController {
1213
@@ -16,8 +17,22 @@ class FullPostController: UITableViewController {
1617 super.viewDidLoad()
1718
1819 tableView.register(PostViewCell.self, forCellReuseIdentifier: postCellId)
20+
21+ setUpNavigationBar()
22+ tableView.separatorStyle = .none
1923 }
2024
25+ func setUpNavigationBar(){
26+ navigationController?.navigationBar.prefersLargeTitles = false
27+ navigationItem.title = "\(String(describing: post?.fromUser.login))"
28+ navigationItem.rightBarButtonItems = [UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(self.options))]
29+ }
30+
31+ @objc func options(){
32+ // copy link
33+ // share
34+ //
35+ }
2136 // MARK: - Table view data source
2237
2338 override func numberOfSections(in tableView: UITableView) -> Int {
@@ -25,6 +40,59 @@ class FullPostController: UITableViewController {
2540 return 2
2641 }
2742
43+ override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
44+ let view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 50))
45+ view.backgroundColor = .white
46+ switch section {
47+ case 0:
48+ return view
49+ default:
50+ return nil
51+ }
52+ }
53+
54+ override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView?
55+ {
56+ let view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 50))
57+
58+ let label = UILabel()
59+ label.font = UIFont.systemFont(ofSize: 14, weight: .regular)
60+ label.text = post?.comments.count == 0 ? "Add first relpy" : "\(post?.comments.count ?? 0) replies"
61+ label.textColor = #colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)
62+
63+ let button = UIButton(type: .detailDisclosure)
64+
65+ view.backgroundColor = .white
66+ view.addSubview(button)
67+ view.addSubview(label)
68+
69+ label.edgesToSuperview(excluding: .right, insets: .left(16))
70+ button.edgesToSuperview(excluding: .left, insets: .right(16))
71+
72+ switch section {
73+ case 0:
74+ return view
75+ default:
76+ return nil
77+ }
78+ }
79+ override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
80+ switch section {
81+ case 0:
82+ return 50
83+ default:
84+ return 0
85+ }
86+ }
87+
88+ override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
89+ switch section {
90+ case 0:
91+ return 50
92+ default:
93+ return 0
94+ }
95+ }
2896 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
2997 {
3098 switch section {
@@ -44,6 +112,8 @@ class FullPostController: UITableViewController {
44112 let cell = tableView.dequeueReusableCell(withIdentifier: postCellId) as! PostViewCell
45113
46114 cell.fill(with: post!.dataArray, true)
115+ cell.selectionStyle = .none
47116 return cell
48117 }
118+
49119}