From 971e3c841ebdb5aa26c40a4bae205de59c2a1c3c Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Sat, 11 Aug 2018 18:12:58 +0200 Subject: [PATCH] Adds option of setting birth time along with birthday if you now it --- Motivation/Configuration.xib | 48 ++++++++++++------- .../ConfigurationWindowController.swift | 11 ++++- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/Motivation/Configuration.xib b/Motivation/Configuration.xib index 73b66a3..b6fb994 100644 --- a/Motivation/Configuration.xib +++ b/Motivation/Configuration.xib @@ -1,12 +1,14 @@ - - + + - + + + @@ -19,13 +21,13 @@ - - + + - - + + @@ -33,13 +35,12 @@ - + - - - - + + + @@ -49,7 +50,7 @@ - - + + + diff --git a/Motivation/ConfigurationWindowController.swift b/Motivation/ConfigurationWindowController.swift index cf12b14..87f92f6 100644 --- a/Motivation/ConfigurationWindowController.swift +++ b/Motivation/ConfigurationWindowController.swift @@ -10,8 +10,9 @@ import AppKit class ConfigurationWindowController: NSWindowController { - // MARK: - Properties + // MARK: - Properties + @IBOutlet weak var birthdatePicker: NSDatePicker! @IBOutlet weak var lightRadio: NSButton! @IBOutlet weak var moderateRadio: NSButton! @IBOutlet weak var terrifyingRadio: NSButton! @@ -23,6 +24,14 @@ class ConfigurationWindowController: NSWindowController { // MARK: - NSWindowController + @IBAction func time(_ sender: NSButton) { + if birthdatePicker.datePickerElements.contains(.hourMinuteDatePickerElementFlag) { + birthdatePicker.datePickerElements = [.yearMonthDayDatePickerElementFlag] + } else { + birthdatePicker.datePickerElements = [.hourMinuteDatePickerElementFlag, .yearMonthDayDatePickerElementFlag] + } + } + override func windowDidLoad() { super.windowDidLoad()