git.iko.soy/dashared/GDproject
on master help sign in
Added tap on hashtags in NewsVC. It's working! I love Model.GetAnonymousChannel
commit6b11f20214595b5db712e1784ac74d06873ab709 authorDarya Rednikina <rednikina.com@yandex.ru> dateSat 4 May 2019, 18:05 (7 years ago) parent8f02f3a
2 files changed+7−7
GDproject/Controller/ News and channels/NewsVC.swift+5−7 GDproject/Controller/ News and channels/PostViewCell.swift+2
GDproject/Controller/ News and channels/NewsVC.swift+5−7
@@ -85,19 +85,17 @@ class NewsVC: UIViewController, UITableViewDelegate, UITableViewDataSource {
8585 vc.idProfile = id
8686 self?.viewController!.navigationController!.pushViewController(vc, animated: true)
8787 }
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+ }
8893 default:
8994 cell.onUserDisplay = { (id) in
9095 print("tapped when profile is opened already \(id)")
9196 }
9297 }
9398
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−
10199 cell.selectionStyle = .none
102100 return cell
103101 }
GDproject/Controller/ News and channels/PostViewCell.swift+2
@@ -13,6 +13,7 @@ import TinyConstraints
1313
1414class PostViewCell: UITableViewCell
1515{
16+
1617 var onUserDisplay: ((Int)->())?
1718
1819 var onAnonymousChannelDisplay: ((String)->())?
@@ -123,6 +124,7 @@ class PostViewCell: UITableViewCell
123124 let button = UIButton()
124125 button.setTitle("#" + hash, for: .normal)
125126 button.addTarget(self, action: #selector(setAnonymousChannel(on:)), for: .touchUpInside)
127+ // button.addGestureRecognizer(longPressRecognizer)
126128 button.titleLabel?.font = UIFont.monospacedDigitSystemFont(ofSize: 15, weight: .semibold)
127129 button.setTitleColor(#colorLiteral(red: 0, green: 0.4784313725, blue: 1, alpha: 1), for: .normal)
128130 buttons.append(button)