forked from zhiphe/Potatso-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RequestOverviewVC.swift
80 lines (66 loc) · 2.06 KB
/
RequestOverviewVC.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// RequestOverviewVC.swift
// Potatso
//
// Created by LEI on 7/15/16.
// Copyright © 2016 TouchingApp. All rights reserved.
//
import Foundation
import Eureka
class RequestOverviewVC: FormViewController {
let request: Request
init(request: Request) {
self.request = request
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
handleRefreshUI()
}
func handleRefreshUI() {
updateForm()
}
func updateForm() {
form.delegate = nil
form.removeAll()
form +++ generateTimelineSection()
form.delegate = self
tableView?.reloadData()
}
func generateTimelineSection() -> Section {
let section = Section()
for event in request.events {
section <<< RequestEventRow() {
$0.value = event
}
}
return section
}
func tableView(tableView: UITableView, shouldShowMenuForRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
func tableView(tableView: UITableView, canPerformAction action: Selector, forRowAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) -> Bool {
return true
//return action == (#selector(_NSContiguousString.copy))
}
func tableView(tableView: UITableView, performAction action: Selector, forRowAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) {
/*
switch action {
case (#selector(_NSContiguousString.copy)):
guard let cell = tableView.cellForRow(at: indexPath as IndexPath) as? RequestEventRowCell else {
return
}
UIPasteboard.general.string = cell.copyContent
// implement copy here
default:
assertionFailure()
}
*/
}
}