-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorkoutsViewController.swift
61 lines (47 loc) · 1.72 KB
/
WorkoutsViewController.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
//
// WorkoutsViewController.swift
// Cardiologic
//
// Created by Ben Zimring on 8/21/18.
// Copyright © 2018 pulseApp. All rights reserved.
//
import UIKit
class WorkoutsViewController: UIViewController {
let workouts = ["workout1", "workout2", "workout3"]
let cellSpacingHeight: CGFloat = 10
@IBOutlet weak var workoutsTable: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func didTouchDoneButton(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
}
extension WorkoutsViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func numberOfSections(in tableView: UITableView) -> Int {
return workouts.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = workoutsTable.dequeueReusableCell(withIdentifier: "workoutCell")!
cell.textLabel?.text = workouts[indexPath.section]
cell.backgroundColor = .white
cell.layer.borderColor = UIColor.black.cgColor
cell.layer.borderWidth = 1
cell.layer.cornerRadius = 8
cell.clipsToBounds = true
return cell
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return cellSpacingHeight
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}
}