@@ -28,19 +28,17 @@ class SettingsVC: UITableViewController, MFMailComposeViewControllerDelegate {
28
28
29
29
enum cellNames {
30
30
case northType
31
+ case distance
31
32
case contact
32
33
case terms
33
34
case share
34
- case red
35
35
}
36
36
}
37
37
38
38
let sectionArray = [
39
39
section ( name: . general, cells: [
40
- cell ( name: . northType) ,
41
- cell ( name: . red) ,
42
- cell ( name: . red) ,
43
- cell ( name: . red)
40
+ cell ( name: . distance) ,
41
+ cell ( name: . northType)
44
42
] ) ,
45
43
section ( name: . contact, cells: [
46
44
cell ( name: . contact) ,
@@ -57,13 +55,13 @@ class SettingsVC: UITableViewController, MFMailComposeViewControllerDelegate {
57
55
override func viewDidLoad( ) {
58
56
super. viewDidLoad ( )
59
57
title = " Settings "
60
- navigationItem. rightBarButtonItem = UIBarButtonItem ( title : " Done " , style : . done, target: self , action: #selector( donePressed) )
58
+ navigationItem. rightBarButtonItem = UIBarButtonItem ( barButtonSystemItem : . done, target: self , action: #selector( donePressed) )
61
59
62
- tableView = UITableView ( frame: self . tableView. frame, style: . insetGrouped)
60
+ tableView = UITableView ( frame: tableView. frame, style: . insetGrouped)
63
61
tableView. register ( UITableViewCell . self, forCellReuseIdentifier: UITableViewCell . cellID)
64
62
tableView. register ( SegmentedCell . self, forCellReuseIdentifier: SegmentedCell . id)
65
63
tableView. register ( ContactCell . self, forCellReuseIdentifier: ContactCell . id)
66
- // tableView.sectionHeaderHeight = 70
64
+ tableView. register ( DistanceCell . self , forCellReuseIdentifier : DistanceCell . id )
67
65
}
68
66
69
67
@objc func donePressed( ) {
@@ -77,6 +75,10 @@ class SettingsVC: UITableViewController, MFMailComposeViewControllerDelegate {
77
75
cell. selectionStyle = . none
78
76
cell. segmentedControl. addTarget ( self , action: #selector( northTypeChanged ( _: ) ) , for: . valueChanged)
79
77
return cell
78
+ case . distance:
79
+ let cell = tableView. dequeueReusableCell ( withIdentifier: DistanceCell . id, for: indexPath) as! DistanceCell
80
+ cell. selectionStyle = . none
81
+ return cell
80
82
case . contact:
81
83
let cell = tableView. dequeueReusableCell ( withIdentifier: ContactCell . id, for: indexPath) as! ContactCell
82
84
cell. iconImageView. image = contactInfo [ indexPath. row] . 0
@@ -90,10 +92,6 @@ class SettingsVC: UITableViewController, MFMailComposeViewControllerDelegate {
90
92
let cell = tableView. dequeueReusableCell ( withIdentifier: UITableViewCell . cellID, for: indexPath)
91
93
cell. textLabel? . text = " Share "
92
94
return cell
93
- case . red:
94
- let cell = tableView. dequeueReusableCell ( withIdentifier: UITableViewCell . cellID, for: indexPath)
95
- cell. textLabel? . text = " y \( indexPath. row) lo "
96
- return cell
97
95
}
98
96
}
99
97
@@ -168,7 +166,7 @@ class SettingsVC: UITableViewController, MFMailComposeViewControllerDelegate {
168
166
169
167
170
168
@objc private func northTypeChanged( _ sender: UISegmentedControl ) {
171
- save. northType = ( sender. selectedSegmentIndex == 0 ) ? . trueNorth : . magneticNorth
169
+ save. trueNorth = sender. selectedSegmentIndex == 0
172
170
}
173
171
174
172
}
0 commit comments