RiValT_EditTimer_ViewController

@MainActor
class RiValT_EditTimer_ViewController : RiValT_Base_ViewController
extension RiValT_EditTimer_ViewController: UIPickerViewDataSource
extension RiValT_EditTimer_ViewController: UIPickerViewDelegate
extension RiValT_EditTimer_ViewController: UIPickerViewAccessibilityDelegate

This view controller allows us to set the timer thresholds for each individual timer.

This has a segmented switch, which allows the user to pick which of the thresholds they want to edit. Until a Start Time has been set, the Warning Time and Final time choices are disabled.

Once a Start Time is selected, the Warning Time and Final Time choices become available. They cannot be set equal to, or higher than, the Start Time. The Final Threshold can also not be higher than the Warning Threshold, unless the Warning Threshold is at 00:00:00 (off).

There is also a “Play” triangle, below the time picker. This is disabled, if the Start Time is at 00:00:00, but becomes enabled, once a Start Time has been specified. Selecting this, brings in the Running Timer Screen for the current timer.

The Various Set Time States

The Various Columns in the Picker

  • These are the indexes for the picker columns.

    See more

    Declaration

    Swift

    enum PickerRow : Int, CaseIterable
  • The large variant of the digital display font.

    Declaration

    Swift

    @MainActor
    private static let _digitalDisplayFont: UIFont?
  • The ID for segue to the settings editor.

    Declaration

    Swift

    @MainActor
    private static let _editGroupSegueID: String
  • The storyboard ID for instantiating the class.

    Declaration

    Swift

    @MainActor
    static let storyboardID: String
  • The timer instance associated with this screen.

    It is implicit optional, because we’re in trouble, if it’s nil.

    Declaration

    Swift

    @MainActor
    weak var timer: Timer! { get set }
  • This is the page view container that “owns” this screen.

    Declaration

    Swift

    @MainActor
    weak var myContainer: RiValT_TimerEditor_PageViewContainer?
  • Describes how the edited timer fits into its group.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var groupSummaryLabel: UILabel?
  • Container for the set time wheels.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var setTimeContainerView: UIStackView?
  • The storyboard stack containing Play and the associated controls.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var playControlsStack: UIStackView?
  • The button that offers the shortcut for the currently selected phase.

    Declaration

    Swift

    @MainActor
    private let phaseShortcutButton: UIButton
  • The explanatory text shown beside the phase shortcut.

    Declaration

    Swift

    @MainActor
    private let phaseMessageLabel: UILabel
  • The play-area stack containing the shortcut and its accompanying text.

    Declaration

    Swift

    @MainActor
    private lazy var phaseGuide: UIStackView { get set }
  • This selects between set time, warn time, and final time.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var timeTypeSegmentedControl: UISegmentedControl?
  • The time set picker view.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var timeSetPicker: UIPickerView?
  • The Hours label, above the picker.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var hoursLabel: UILabel?
  • The Minutes label, above the picker.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var minutesLabel: UILabel?
  • The Seconds label, above the picker.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var secondsLabel: UILabel?
  • The toolbar at the bottom.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var toolbar: UIToolbar?
  • The label above the time set, indicating the selected time.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var statusLabel: UILabel?
  • The “play” triangle, under the pickers.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    weak var playButton: UIButton?

Computed Properties

Base Class Overrides

  • Called when the view has loaded.

    Declaration

    Swift

    @MainActor
    override func viewDidLoad()
  • Called when the view is about to appear

    Declaration

    Swift

    @MainActor
    override func viewWillAppear(_ inIsAnimated: Bool)

    Parameters

    inIsAnimated

    True, if the appearance is animated.

  • Called when the view has appeared

    Declaration

    Swift

    @MainActor
    override func viewDidAppear(_ inIsAnimated: Bool)

    Parameters

    inIsAnimated

    True, if the appearance is animated.

  • Positions the phase guide for the current vertical size class while keeping Play centered.

    Declaration

    Swift

    @MainActor
    override func viewWillLayoutSubviews()
  • Called when the view has laid itself out.

    Declaration

    Swift

    @MainActor
    override func viewDidLayoutSubviews()

Instance Methods

Callbacks

  • Called when the time type segmented control is changed.

    Declaration

    Swift

    @IBAction
    @MainActor
    func timeTypeSegmentedControlChanged(_ inSegmentedControl: UISegmentedControl)

    Parameters

    inSegmentedControl

    The control that was changed

  • Clears the thresholds or moves the chosen threshold just below the timer’s starting duration.

    Declaration

    Swift

    @objc
    @MainActor
    private func applyPhaseShortcut()
  • Called when the “play” button is hit.

    Declaration

    Swift

    @IBAction
    @MainActor
    func playButtonHit(_: Any)

UIPickerViewDataSource Conformance

UIPickerViewDelegate Conformance

  • Returns the displayed row for the selected column and row.

    Declaration

    Swift

    @MainActor
    func pickerView(_ inPickerView: UIPickerView, viewForRow inRow: Int, forComponent inComponent: Int, reusing inReusing: UIView?) -> UIView

    Parameters

    inPickerView

    The picker view

    inRow

    The specified row.

    inComponent

    The selected column.

    inReusing

    If the view is being reused, it is set here (ignored).

  • The height of each row.

    Declaration

    Swift

    @MainActor
    func pickerView(_ inPickerView: UIPickerView, rowHeightForComponent inComponent: Int) -> CGFloat

    Parameters

    inPickerView

    The picker view (ignored)

    inComponent

    The selected column (ignored)

    Return Value

    70 (always)

  • Called when a column of the picker view has been changed.

    Declaration

    Swift

    @MainActor
    func pickerView(_ inPickerView: UIPickerView, didSelectRow inRow: Int, inComponent: Int)

    Parameters

    inPickerView

    The picker view

    inRow

    The specified row.

    inComponent

    The selected column.

UIPickerViewAccessibilityDelegate Conformance

  • This returns the accessibility hint for the picker component.

    Declaration

    Swift

    @MainActor
    func pickerView(_ inPickerView: UIPickerView, accessibilityLabelForComponent inComponentIndex: Int) -> String?

    Parameters

    inPickerView

    The picker instance

    inComponentIndex

    The 0-based component index for the label.

    Return Value

    An accessibility string for the component.

  • This returns the accessibility hint for the picker component.

    Declaration

    Swift

    @MainActor
    func pickerView(_ inPickerView: UIPickerView, accessibilityHintForComponent inComponentIndex: Int) -> String?

    Parameters

    inPickerView

    The picker instance

    inComponentIndex

    The 0-based component index for the Hint (ignored).

    Return Value

    An accessibility string for the component.