DroppyWidgetTimeline
A TimelineView that ticks only while the widget is on screen and the shelf is still (DroppyKit 1.23.0): it stops while dropletWidgetIsVisible is false and while the shelf springs, so a clock costs nothing on a closed shelf.
@MainActor struct DroppyWidgetTimeline<Content> where Content : View
DroppyWidgetTimeline(every: 1) { now in
ShelfWidgetReadout(now.formatted(date: .omitted, time: .standard))
}Available from DroppyKit 1.23.0.
Initializers
init(every:content:)
@MainActor init(every interval: TimeInterval, @ViewBuilder content: @escaping (Date) -> Content)
Creates the timeline.
- Parameters:
- interval: Seconds between ticks, at least a twentieth of a second.
- content: The view for one tick's date.
Properties
body
@MainActor var body: some View { get }