[O] Encapsulate Alarm.textLabel

This commit is contained in:
Hykilpikonna
2021-01-26 17:38:02 -05:00
parent 8183907366
commit dea555d5c2
2 changed files with 4 additions and 2 deletions
+1 -2
View File
@@ -497,8 +497,7 @@ extension FamilyAddAlarmVC: UITableViewDelegate, UITableViewDataSource
func tableView(_ view: UITableView, cellForRowAt i: IndexPath) -> UITableViewCell
{
let cell = view.dequeueReusableCell(withIdentifier: "family-alarm-cell", for: i)
let alarm = Alarms.fromLocal().list[i.row]
cell.textLabel?.text = String(format: "%i:%02i", alarm.hour, alarm.minute)
cell.textLabel?.text = Alarms.fromLocal().list[i.row].timeText
return cell
}
+3
View File
@@ -90,6 +90,9 @@ class Alarm: Codable, Equatable
/// Does it automatically disable after activating once
var oneTime: Bool { repeats.allSatisfy { !$0 } }
/// Get time in h:mm format
var timeText: String { String(format: "%i:%02i", hour, minute) }
/// When should the alarm activate next since lastActivate?
var nextActivate: Date?
{