Skip to content

Timer State Control

Alina P edited this page Dec 12, 2024 · 5 revisions

Problem w tym - powiedział Hampty Dampty - kto kim rządzi. To wszystko.

Timer State Control

Overview

There are various methods available for managing the timer's state, including starting, pausing, and even resetting it.

Available Methods

  • start methods.
    • To get more information about how to start the timer see Timer Start-Up page.

  • func cancel()
    • Stop the timer
    • Resets its current time to the initial value.
MTimer(.id).cancel()

The command shifts the timer publishers into the following state.

timerTime = start time
timerStatus = .notStarted
timerProgress = 0


  • func pause()
    • Pause the timer.
MTimer(.id).pause()

The command shifts the timer publishers into the following state.

timerTime = current time
timerStatus = .paused
timerProgress = current progress


  • func resume() throws
    • Resume the paused timer.
try MTimer(.id).resume()

The command shifts the timer publishers into the following state.

timerTime = current time
timerStatus = .running
timerProgress = current progress


  • func skip() throws
    • Stop the timer
    • Updates timer status to the final state
try MTimer(.id).skip()

The command shifts the timer publishers into the following state.

timerTime = end time
timerStatus = .finished
timerProgress = 1.0


  • func reset()
    • Stop the timer
    • Resets all timer states to default
MTimer(.id).reset()

The command shifts the timer publishers into the following state.

timerTime = 0
timerStatus = .notStarted
timerProgress = 0

See also