git.iko.soy/dashared/GDproject
on master help sign in
Added tap on hashtags in NewsVC. It's working! I love Model.GetAnonymousChannel
6b11f20Darya Rednikina
GDproject/Controller/ News and channels/NewsVC.swift+5−7
@@ -85,19 +85,17 @@ class NewsVC: UIViewController, UITableViewDelegate, UITableViewDataSource {
85 vc.idProfile = id
85 vc.idProfile = id
86 self?.viewController!.navigationController!.pushViewController(vc, animated: true)
86 self?.viewController!.navigationController!.pushViewController(vc, animated: true)
87 }
87 }
88+
89+ cell.onAnonymousChannelDisplay = {
90+ [weak self] in
91+ (self?.viewController as? UpdateableWithChannel)?.updateChannel(on: Model.Channels(people: [], name: $0, id: 0, tags: [$0]))
92+ }
88 default:
93 default:
89 cell.onUserDisplay = { (id) in
94 cell.onUserDisplay = { (id) in
90 print("tapped when profile is opened already \(id)")
95 print("tapped when profile is opened already \(id)")
91 }
96 }
92 }
97 }
93
98
94−// cell.onAnonymousChannelDisplay = {
95−// [weak self] (tag) in
96−// Model.getAnonymousChannel(by: Model.AnonymousChannel(people: [], tags: [tag]),
97−// completion: { (tuple) in self?.onChannelDidChange?(tuple) }
98−// )
99−// }
100−
101 cell.selectionStyle = .none
99 cell.selectionStyle = .none
102 return cell
100 return cell
103 }
101 }
GDproject/Controller/ News and channels/PostViewCell.swift+2
@@ -13,6 +13,7 @@ import TinyConstraints
13
13
14class PostViewCell: UITableViewCell
14class PostViewCell: UITableViewCell
15{
15{
16+
16 var onUserDisplay: ((Int)->())?
17 var onUserDisplay: ((Int)->())?
17
18
18 var onAnonymousChannelDisplay: ((String)->())?
19 var onAnonymousChannelDisplay: ((String)->())?
@@ -123,6 +124,7 @@ class PostViewCell: UITableViewCell
123 let button = UIButton()
124 let button = UIButton()
124 button.setTitle("#" + hash, for: .normal)
125 button.setTitle("#" + hash, for: .normal)
125 button.addTarget(self, action: #selector(setAnonymousChannel(on:)), for: .touchUpInside)
126 button.addTarget(self, action: #selector(setAnonymousChannel(on:)), for: .touchUpInside)
127+ // button.addGestureRecognizer(longPressRecognizer)
126 button.titleLabel?.font = UIFont.monospacedDigitSystemFont(ofSize: 15, weight: .semibold)
128 button.titleLabel?.font = UIFont.monospacedDigitSystemFont(ofSize: 15, weight: .semibold)
127 button.setTitleColor(#colorLiteral(red: 0, green: 0.4784313725, blue: 1, alpha: 1), for: .normal)
129 button.setTitleColor(#colorLiteral(red: 0, green: 0.4784313725, blue: 1, alpha: 1), for: .normal)
128 buttons.append(button)
130 buttons.append(button)