[+] Add family add alarm table

This commit is contained in:
Hykilpikonna
2021-01-26 15:18:56 -05:00
parent ab95dbfe46
commit 2b9e54f485
3 changed files with 70 additions and 8 deletions
+4 -4
View File
@@ -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 = "<group>"; };
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 = "<group>"; };
4FF0684225A5F18700304E6B /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = "<group>"; };
4FF0684225A5F18700304E6B /* Account.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = "<group>"; };
4FF0684525A5F18700304E6B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
4FF0684725A5F18800304E6B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
4FF0684A25A5F18800304E6B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
@@ -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 */,
@@ -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)
}
}
+16 -3
View File
@@ -1117,10 +1117,10 @@
</objects>
<point key="canvasLocation" x="1664" y="2271"/>
</scene>
<!--View Controller-->
<!--Family Add AlarmVC-->
<scene sceneID="nfh-Af-0i6">
<objects>
<viewController id="tsc-Sa-flN" sceneMemberID="viewController">
<viewController id="tsc-Sa-flN" customClass="FamilyAddAlarmVC" customModule="ProjectClock" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="cjq-um-dZr">
<rect key="frame" x="0.0" y="0.0" width="414" height="650"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -1128,6 +1128,16 @@
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Tnv-t2-x4g">
<rect key="frame" x="20" y="191" width="374" height="439"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="family-alarm-cell" id="Suf-xg-DzL">
<rect key="frame" x="0.0" y="28" width="374" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Suf-xg-DzL" id="Ic2-YQ-FgT">
<rect key="frame" x="0.0" y="0.0" width="374" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
</tableView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Family" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vbG-Sp-h0i">
<rect key="frame" x="20" y="20" width="374" height="20.5"/>
@@ -1168,6 +1178,9 @@
</constraints>
</view>
<navigationItem key="navigationItem" id="g8i-R5-KT9"/>
<connections>
<outlet property="table" destination="Tnv-t2-x4g" id="lsv-3K-jRC"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8aw-Tn-lRs" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
@@ -1200,7 +1213,7 @@
<rect key="frame" x="0.0" y="30.5" width="374" height="354.5"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="cell" rowHeight="66" id="PpM-BI-Arz">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="family-member-cell" rowHeight="66" id="PpM-BI-Arz">
<rect key="frame" x="0.0" y="28" width="374" height="66"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="PpM-BI-Arz" id="zXh-kT-4wz">