Alarms are now editable.

This commit is contained in:
Aaron
2021-01-26 16:23:23 -05:00
parent 2437c52faf
commit 0de6aeef80
3 changed files with 98 additions and 7 deletions
+11
View File
@@ -55,6 +55,14 @@ extension AlarmViewController: UITableViewDelegate, UITableViewDataSource
/// IDK what this does (TODO: Find out what this does)
func tableView(_ v: UITableView, didSelectRowAt i: IndexPath) { v.deselectRow(at: i, animated: true) }
/// Sends the selected alarm to be edited
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "edit-alarm" {
let vc = segue.destination as! AddAlarmViewController
vc.alarmCell = (sender as! AlarmTableCell)
}
}
}
/**
@@ -68,6 +76,8 @@ class AlarmTableCell: UITableViewCell
@IBOutlet weak var enable: UISwitch!
@IBOutlet weak var repeatText: UILabel!
@IBOutlet weak var goingOffText: UILabel!
@IBOutlet weak var wvmText: UILabel!
var alarm: Alarm!
@@ -79,6 +89,7 @@ class AlarmTableCell: UITableViewCell
self.alarm = alarm
descriptionText.text = "- " + alarm.text
enable.isOn = alarm.enabled
wvmText.text = alarm.wakeMethod.name
// Display Hour, Minute, and AM or PM
ampm.text = alarm.hour < 12 || alarm.hour == 24 ? "AM" : "PM"