TimerGroup

class TimerGroup : Equatable
extension TimerGroup: Hashable
extension TimerGroup: Sequence
extension TimerGroup: CustomDebugStringConvertible

This is a group of sequential timers.

The timers are executed in the order of their storage in the _timers array.

This is a class, so it can be referenced.

Extension for Integrating Persistent Settings

  • This enum defines one of the three different display types for a running timer.

    See more

    Declaration

    Swift

    enum SoundType
  • This enum defines one of the three different display types for a running timer.

    See more

    Declaration

    Swift

    enum DisplayType : String, CaseIterable
  • Equatable Conformance

    Declaration

    Swift

    static func == (lhs: TimerGroup, rhs: TimerGroup) -> Bool

    Parameters

    lhs

    The left-hand side of the comparison.

    rhs

    The right-hand side of the comparison.

    Return Value

    True, if the two groups are the same.

  • The maximum number of timers.

    Declaration

    Swift

    static let maxTimersInGroup: Int
  • These are the timers that comprise the group. The order of the array, is the order of timer execution.

    Declaration

    Swift

    fileprivate var _timers: [Timer]
  • id

    A unique ID, for comparing.

    Declaration

    Swift

    var id: UUID
  • The type of display for the group.

    Declaration

    Swift

    var displayType: DisplayType
  • The final alarm sound.

    Declaration

    Swift

    var soundType: SoundType
  • The sound used for transitions between timers in the group.

    Declaration

    Swift

    var transitionSoundFilename: String?
  • The container that “owns” this group.

    Declaration

    Swift

    var model: TimerModel?
  • Main Initializer

    Declaration

    Swift

    init(container inContainer: TimerModel, dictionary inDictionary: [[String : any Hashable]]? = nil)

    Parameters

    inContainer

    The container that “owns” this group.

    inDictionary

    The dictionary that contains the preserved state.

Computed Properties

  • The number of timers in this group.

    Declaration

    Swift

    var count: Int { get }
  • True, if there are no timers.

    Declaration

    Swift

    var isEmpty: Bool { get }
  • True, if one of the group’s timers is selected (READ ONLY).

    Declaration

    Swift

    var isSelected: Bool { get }
  • True, if there is no more room for timers.

    Declaration

    Swift

    var isFull: Bool { get }
  • this exports the current timer state, or allows you to recreate the group, based on a stored state.

    Declaration

    Swift

    var asArray: [[String : any Hashable]] { get set }
  • The index of this group, in the model.

    Declaration

    Swift

    var index: Int? { get }
  • All of the timer wrappers.

    Declaration

    Swift

    var allTimers: [Timer] { get }
  • The first timer

    Declaration

    Swift

    var first: Timer? { get }
  • The last timer

    Declaration

    Swift

    var last: Timer? { get }
  • The selected timer (nil, if none selected).

    Declaration

    Swift

    var selectedTimer: Timer? { get }

Instance Methods

  • Simple subscript access to the timers.

    Declaration

    Swift

    subscript(inIndex: Int) -> Timer { get }

    Parameters

    inIndex

    The 0-based index of the timer we want to reference.

  • Appends a new timer instance to the end of the array.

    Declaration

    Swift

    func addTimer() -> Timer?

    Return Value

    A reference to the new timer instance. Nil, if the timer was not created.

  • Deletes a timer from the array.

    Declaration

    Swift

    func deleteTimer(at inIndex: Int) -> Timer?

    Parameters

    inIndex

    A 0-based index of the timer to be deleted. Must be 0..timers.count

    Return Value

    A reference to the deleted timer instance. Nil, if the timer was not found.

Hashable Conformance

  • Hash dealer.

    Declaration

    Swift

    func hash(into inOutHasher: inout Hasher)

    Parameters

    inOutHasher

    The hasher we’re loading up.

Iterator Conformance

Instance Methods

  • Emits a formatted string, describing the model.

    Declaration

    Swift

    var debugDescription: String { get }