[O] Encapsulate Alarm.textLabel
This commit is contained in:
@@ -497,8 +497,7 @@ extension FamilyAddAlarmVC: UITableViewDelegate, UITableViewDataSource
|
|||||||
func tableView(_ view: UITableView, cellForRowAt i: IndexPath) -> UITableViewCell
|
func tableView(_ view: UITableView, cellForRowAt i: IndexPath) -> UITableViewCell
|
||||||
{
|
{
|
||||||
let cell = view.dequeueReusableCell(withIdentifier: "family-alarm-cell", for: i)
|
let cell = view.dequeueReusableCell(withIdentifier: "family-alarm-cell", for: i)
|
||||||
let alarm = Alarms.fromLocal().list[i.row]
|
cell.textLabel?.text = Alarms.fromLocal().list[i.row].timeText
|
||||||
cell.textLabel?.text = String(format: "%i:%02i", alarm.hour, alarm.minute)
|
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ class Alarm: Codable, Equatable
|
|||||||
/// Does it automatically disable after activating once
|
/// Does it automatically disable after activating once
|
||||||
var oneTime: Bool { repeats.allSatisfy { !$0 } }
|
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?
|
/// When should the alarm activate next since lastActivate?
|
||||||
var nextActivate: Date?
|
var nextActivate: Date?
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user