-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathTableViewController.swift
More file actions
81 lines (71 loc) · 2.06 KB
/
Copy pathTableViewController.swift
File metadata and controls
81 lines (71 loc) · 2.06 KB
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
81
//
// TableViewController.swift
// StateViewControllerExample
//
// Created by David Ask on 2018-08-16.
// Copyright © 2018 Formbound. All rights reserved.
//
import StateViewController
import UIKit
class TableViewController: UITableViewController {
var comments: [Comment] = [] {
didSet {
tableView.reloadData()
}
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return comments.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
}
override func tableView(
_ tableView: UITableView,
willDisplay cell: UITableViewCell,
forRowAt indexPath: IndexPath
) {
let comment = comments[indexPath.row]
cell.textLabel?.text = comment.name
cell.detailTextLabel?.text = comment.body
}
}
//
//
//extension TableViewController: StateViewControllerTransitioning {
//
// func stateTransitionDuration(isAppearing: Bool) -> TimeInterval {
// return 0.25
// }
//
// func stateTransitionWillBegin(isAppearing: Bool) {
// if isAppearing {
// view.alpha = 0
// view.transform = CGAffineTransform.identity.scaledBy(x: 0.95, y: 0.95)
// }
// }
//
// func stateTransitionDidEnd(isAppearing: Bool) {
// view.alpha = 1
// view.transform = .identity
// }
//
// func animateAlongsideStateTransition(isAppearing: Bool) {
// if isAppearing {
// view.alpha = 1
// view.transform = .identity
// } else {
// view.alpha = 0
// view.transform = CGAffineTransform.identity.scaledBy(x: 0.95, y: 0.95)
// }
// }
//
// func stateTransitionDelay(isAppearing: Bool) -> TimeInterval {
// return 0
// }
//}