When to use it
Keep the target instant in host state. Backgrounding pauses updates while absolute time continues. Invalid targets show a placeholder; countdowns stop at zero and report completion once after running. The timer uses no animation.
Display absolute-clock countdowns and elapsed time with controlled announcement frequency.
Apple availability
Import LumenUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.
Native example
Keep the target instant in host state. Backgrounding pauses updates while absolute time continues. Invalid targets show a placeholder; countdowns stop at zero and report completion once after running. The timer uses no animation.
struct CountdownExample: View {
@State private var deadline = Date().addingTimeInterval(65)
var body: some View {
LumenTimer("Time remaining", to: deadline,
units: [.minutes, .seconds], announce: .complete,
completeLabel: "Countdown finished")
}
}Reference
The primary shared and platform-specific options exposed by LumenTimer.
| API | Values or type | Default | Description |
|---|---|---|---|
| label | Localized string | Required | Names the timer independently of its changing digits. |
| mode | countdown · elapsed | countdown | Counts toward to or from the elapsed start. |
| to / from | Date? | Absent | Supplies an absolute instant. Missing or invalid targets show --:--. |
| format | clock · units | clock | Selects a clock or localized duration units. |
| units | days · hours · minutes · seconds | Countdown: all; elapsed: hours/minutes/seconds | The largest selected unit absorbs larger values. |
| announce | off · complete · minute | off | Limits polite announcements to completion or minute changes. |
| completeLabel | String | Timer complete | Application-localized completion copy. |
| onComplete | Optional callback | Absent | Reports one running-to-complete transition per target; an already-expired target is silent. |
Native behavior
Keep the target instant in host state. Backgrounding pauses updates while absolute time continues. Invalid targets show a placeholder; countdowns stop at zero and report completion once after running. The timer uses no animation.
One named timer exposes its current value. Ticking digits are not a live region; opt into polite completion or minute announcements.
Shared component