Added alarm name in storyboard and started implementation of adding alarms
This commit is contained in:
@@ -20,6 +20,7 @@ class AddAlarmViewController: UIViewController
|
|||||||
|
|
||||||
@IBOutlet weak var repeatWeekdaysSwitch: UISwitch!
|
@IBOutlet weak var repeatWeekdaysSwitch: UISwitch!
|
||||||
@IBOutlet weak var repeatWeekendsSwitch: UISwitch!
|
@IBOutlet weak var repeatWeekendsSwitch: UISwitch!
|
||||||
|
@IBOutlet weak var alarmNameTextField: UITextField!
|
||||||
|
|
||||||
|
|
||||||
// Pickers
|
// Pickers
|
||||||
@@ -31,6 +32,17 @@ class AddAlarmViewController: UIViewController
|
|||||||
@IBAction func soundLibraryButton(_ sender: Any) {
|
@IBAction func soundLibraryButton(_ sender: Any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IBAction func addAlarmButton(_ sender: Any) {
|
||||||
|
|
||||||
|
let (h, m, _) = timePicker.date.getHMS()
|
||||||
|
let alarms = Alarms.fromLocal();
|
||||||
|
alarms.list.append(
|
||||||
|
Alarm(hour: h, minute: m, text: "\(alarmNameTextField.text) - \(h * m)", wakeMethod: wvms[0], lastActivate: Date().added(.minute, -1))
|
||||||
|
)
|
||||||
|
alarms.localSave()
|
||||||
|
|
||||||
|
_ = navigationController?.popViewController(animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
override func viewDidLoad()
|
override func viewDidLoad()
|
||||||
{
|
{
|
||||||
@@ -38,8 +50,6 @@ class AddAlarmViewController: UIViewController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class WVMDataSource: UIPickerView, UIPickerViewDelegate, UIPickerViewDataSource
|
class WVMDataSource: UIPickerView, UIPickerViewDelegate, UIPickerViewDataSource
|
||||||
{
|
{
|
||||||
required init?(coder: NSCoder)
|
required init?(coder: NSCoder)
|
||||||
|
|||||||
@@ -410,6 +410,9 @@
|
|||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="30"/>
|
<fontDescription key="fontDescription" type="system" pointSize="30"/>
|
||||||
<state key="normal" image="checkmark" catalog="system"/>
|
<state key="normal" image="checkmark" catalog="system"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="addAlarmButton:" destination="Mki-dC-5Kc" eventType="touchUpInside" id="AiG-Cc-DlR"/>
|
||||||
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6d8-Gi-Ipa">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6d8-Gi-Ipa">
|
||||||
<rect key="frame" x="20" y="20" width="30" height="30"/>
|
<rect key="frame" x="20" y="20" width="30" height="30"/>
|
||||||
@@ -490,7 +493,7 @@
|
|||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="e8v-cM-bxf">
|
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="e8v-cM-bxf">
|
||||||
<rect key="frame" x="20" y="553.5" width="334" height="72"/>
|
<rect key="frame" x="20" y="553.5" width="334" height="116"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="iAX-G9-qxh">
|
<stackView opaque="NO" contentMode="scaleToFill" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="iAX-G9-qxh">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="334" height="31"/>
|
<rect key="frame" x="0.0" y="0.0" width="334" height="31"/>
|
||||||
@@ -520,6 +523,22 @@
|
|||||||
</switch>
|
</switch>
|
||||||
</subviews>
|
</subviews>
|
||||||
</stackView>
|
</stackView>
|
||||||
|
<stackView opaque="NO" contentMode="scaleToFill" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="gdH-Ok-RIH">
|
||||||
|
<rect key="frame" x="0.0" y="82" width="334" height="34"/>
|
||||||
|
<subviews>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Alarm Name:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5LP-Zk-4Sh">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="98.5" height="34"/>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
|
<nil key="textColor"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="bJg-zp-Aan">
|
||||||
|
<rect key="frame" x="118.5" y="0.0" width="215.5" height="34"/>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||||
|
<textInputTraits key="textInputTraits"/>
|
||||||
|
</textField>
|
||||||
|
</subviews>
|
||||||
|
</stackView>
|
||||||
</subviews>
|
</subviews>
|
||||||
</stackView>
|
</stackView>
|
||||||
</subviews>
|
</subviews>
|
||||||
@@ -581,6 +600,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<navigationItem key="navigationItem" id="Ydw-dw-vLC"/>
|
<navigationItem key="navigationItem" id="Ydw-dw-vLC"/>
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="alarmNameTextField" destination="bJg-zp-Aan" id="Itt-3v-GJB"/>
|
||||||
<outlet property="repeatWeekdaysSwitch" destination="5oN-BL-Xtu" id="gqb-l3-1jZ"/>
|
<outlet property="repeatWeekdaysSwitch" destination="5oN-BL-Xtu" id="gqb-l3-1jZ"/>
|
||||||
<outlet property="repeatWeekendsSwitch" destination="WPM-Fh-sRB" id="LB7-zW-jpC"/>
|
<outlet property="repeatWeekendsSwitch" destination="WPM-Fh-sRB" id="LB7-zW-jpC"/>
|
||||||
<outlet property="scrollView" destination="ybc-8d-6pJ" id="m1B-ff-zeC"/>
|
<outlet property="scrollView" destination="ybc-8d-6pJ" id="m1B-ff-zeC"/>
|
||||||
@@ -591,7 +611,7 @@
|
|||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="0OD-e8-Pfh" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="0OD-e8-Pfh" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="-494" y="1576"/>
|
<point key="canvasLocation" x="-494.20289855072468" y="1575.6696428571429"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Alarm Activation View Controller-->
|
<!--Alarm Activation View Controller-->
|
||||||
<scene sceneID="21H-AI-pzd">
|
<scene sceneID="21H-AI-pzd">
|
||||||
|
|||||||
Reference in New Issue
Block a user