-
-
Notifications
You must be signed in to change notification settings - Fork 413
Timer Dynamic Property
Vatsal Manot edited this page Jun 25, 2020
·
3 revisions
Working with timers in SwiftUI can often require a fair amount of boilerplate, and a simpler API is desirable. This is where @TimerState
comes in.
Usage:
struct ContentView: View {
@TimerState(interval: 2) var timeElapsed: Int // interval is the time interval in seconds
var body: some View {
Text("\(timeElapsed * 2) second(s) have elapsed")
}
}
If you see any problems with the content above, please file an issue here.