diff --git a/ProjectClock/AlarmActivator.swift b/ProjectClock/AlarmActivator.swift index 77ba922..725260a 100644 --- a/ProjectClock/AlarmActivator.swift +++ b/ProjectClock/AlarmActivator.swift @@ -10,8 +10,7 @@ import Foundation /** Class to activate alarms when the user is inside the app - Note: This will not run when app is switched to the background, - but it will run right after the user switched back to the app. + Note: This will not run when app is switched to the background or when the display is turned off, but it will run right after the user switched back to the app. */ class AlarmActivator { @@ -44,6 +43,7 @@ class AlarmActivator */ @objc func check() { + NSLog("Check") } } diff --git a/ProjectClock/AlarmViewController.swift b/ProjectClock/AlarmViewController.swift index 17b0dfd..433c105 100644 --- a/ProjectClock/AlarmViewController.swift +++ b/ProjectClock/AlarmViewController.swift @@ -4,9 +4,6 @@ class AlarmViewController: UIViewController { @IBOutlet weak var table: UITableView! - // TODO: Remove example and use localStorage - var data: [Alarm] = [Alarm(alarmTime: Date(), text: "Wake up lol", wakeMethod: wvms[0])] - override func viewDidLoad() { super.viewDidLoad() @@ -26,7 +23,7 @@ extension AlarmViewController: UITableViewDelegate, UITableViewDataSource func numberOfSections(in: UITableView) -> Int { return 1 } /// How many rows are there - func tableView(_ v: UITableView, numberOfRowsInSection s: Int) -> Int { return data.count } + func tableView(_ v: UITableView, numberOfRowsInSection s: Int) -> Int { return getLocalAlarms().count } /// Configure each cell func tableView(_ v: UITableView, cellForRowAt i: IndexPath) -> UITableViewCell @@ -34,7 +31,7 @@ extension AlarmViewController: UITableViewDelegate, UITableViewDataSource // Get the cell and item at index i let rawCell = v.dequeueReusableCell(withIdentifier: "alarm", for: i) guard let cell = rawCell as? AlarmTableCell else { return rawCell } - let item = data[i.row] + let item = getLocalAlarms()[i.row] // Set the content of the cell to the content of the item. cell.setData(item) diff --git a/ProjectClock/Base.lproj/Main.storyboard b/ProjectClock/Base.lproj/Main.storyboard index 8eb27d7..2d307b8 100644 --- a/ProjectClock/Base.lproj/Main.storyboard +++ b/ProjectClock/Base.lproj/Main.storyboard @@ -64,7 +64,7 @@