diff --git a/ProjectClock.xcodeproj/project.pbxproj b/ProjectClock.xcodeproj/project.pbxproj index 7c84686..5bfe699 100644 --- a/ProjectClock.xcodeproj/project.pbxproj +++ b/ProjectClock.xcodeproj/project.pbxproj @@ -15,7 +15,7 @@ 4FD642DB25B4B7F60069171E /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FD642DA25B4B7F60069171E /* Utils.swift */; }; 4FD642E025B4D5F30069171E /* AlarmActivationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FD642DF25B4D5F30069171E /* AlarmActivationViewController.swift */; }; 4FF0683F25A5F18700304E6B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FF0683E25A5F18700304E6B /* AppDelegate.swift */; }; - 4FF0684325A5F18700304E6B /* AccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FF0684225A5F18700304E6B /* AccountViewController.swift */; }; + 4FF0684325A5F18700304E6B /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FF0684225A5F18700304E6B /* Account.swift */; }; 4FF0684625A5F18700304E6B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4FF0684425A5F18700304E6B /* Main.storyboard */; }; 4FF0684825A5F18800304E6B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4FF0684725A5F18800304E6B /* Assets.xcassets */; }; 4FF0684B25A5F18800304E6B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4FF0684925A5F18800304E6B /* LaunchScreen.storyboard */; }; @@ -38,7 +38,7 @@ 4FD642DF25B4D5F30069171E /* AlarmActivationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlarmActivationViewController.swift; sourceTree = ""; }; 4FF0683B25A5F18700304E6B /* ProjectClock.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ProjectClock.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4FF0683E25A5F18700304E6B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 4FF0684225A5F18700304E6B /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = ""; }; + 4FF0684225A5F18700304E6B /* Account.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = ""; }; 4FF0684525A5F18700304E6B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 4FF0684725A5F18800304E6B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 4FF0684A25A5F18800304E6B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -86,7 +86,7 @@ isa = PBXGroup; children = ( 7CD385A425BE4639007E9890 /* Sounds */, - 4FF0684225A5F18700304E6B /* AccountViewController.swift */, + 4FF0684225A5F18700304E6B /* Account.swift */, 4F8A607025A9160400D88DC3 /* AddAlarmViewController.swift */, 4FD642DF25B4D5F30069171E /* AlarmActivationViewController.swift */, 4FD642D225B48C380069171E /* AlarmActivator.swift */, @@ -204,7 +204,7 @@ 4F8A607125A9160400D88DC3 /* AddAlarmViewController.swift in Sources */, 4F98955225A9260400F51321 /* Net.swift in Sources */, 7C83963925AF68980027A94C /* DebugViewController.swift in Sources */, - 4FF0684325A5F18700304E6B /* AccountViewController.swift in Sources */, + 4FF0684325A5F18700304E6B /* Account.swift in Sources */, F0DF7C0725BCD9FC0064A26B /* StopwatchViewController.swift in Sources */, 4FF0683F25A5F18700304E6B /* AppDelegate.swift in Sources */, 4FD642D325B48C380069171E /* AlarmActivator.swift in Sources */, diff --git a/ProjectClock/AccountViewController.swift b/ProjectClock/Account.swift similarity index 90% rename from ProjectClock/AccountViewController.swift rename to ProjectClock/Account.swift index d5a8327..dddb40a 100644 --- a/ProjectClock/AccountViewController.swift +++ b/ProjectClock/Account.swift @@ -358,7 +358,7 @@ extension FamilyVC: UITableViewDelegate, UITableViewDataSource */ func tableView(_ view: UITableView, cellForRowAt i: IndexPath) -> UITableViewCell { - let cell = view.dequeueReusableCell(withIdentifier: "cell", for: i) + let cell = view.dequeueReusableCell(withIdentifier: "family-member-cell", for: i) cell.textLabel?.text = Family.fromLocal()!.membersList[i.row] return cell } @@ -369,6 +369,7 @@ extension FamilyVC: UITableViewDelegate, UITableViewDataSource func tableView(_ view: UITableView, didSelectRowAt i: IndexPath) { print(i.row) + view.deselectRow(at: i, animated: true) } } @@ -461,3 +462,51 @@ class FamilyCreateJoinVC: UIViewController } } +/** + View controller for adding an alarm to a fmaily member + */ +class FamilyAddAlarmVC: UIViewController +{ + @IBOutlet weak var table: UITableView! + + override func viewDidLoad() + { + super.viewDidLoad() + + table.delegate = self + table.dataSource = self + } +} + +/** + Table data source + */ +extension FamilyAddAlarmVC: UITableViewDelegate, UITableViewDataSource +{ + /** + Define row count + */ + func tableView(_ _: UITableView, numberOfRowsInSection _: Int) -> Int + { + return Alarms.fromLocal().list.count + } + + /** + Set cell at i + */ + 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) + return cell + } + + /** + Called when the user clicks on the cell at i + */ + func tableView(_ view: UITableView, didSelectRowAt i: IndexPath) + { + view.deselectRow(at: i, animated: true) + } +} diff --git a/ProjectClock/Base.lproj/Main.storyboard b/ProjectClock/Base.lproj/Main.storyboard index 7874ade..3b51501 100644 --- a/ProjectClock/Base.lproj/Main.storyboard +++ b/ProjectClock/Base.lproj/Main.storyboard @@ -1117,10 +1117,10 @@ - + - + @@ -1128,6 +1128,16 @@ + + + + + + + + + + + + + @@ -1200,7 +1213,7 @@ - +