init(_:value:total:)
Creates a progress view for showing determinate progress that generates its label from a string.
Declaration
nonisolated init<S, V>(_ title: S, value: V?, total: V = 1.0) where Label == Text, CurrentValueLabel == EmptyView, S : StringProtocol, V : BinaryFloatingPointParameters
- title:
The string that describes the task in progress.
- value:
The completed amount of the task to this point, in a range of
0.0tototal, ornilif the progress is indeterminate. - total:
The full amount representing the complete scope of the task, meaning the task is complete if
valueequalstotal. The default value is1.0.
Discussion
If the value is non-nil, but outside the range of 0.0 through total, the progress view pins the value to those limits, rounding to the nearest possible bound. A value of nil represents indeterminate progress, in which case the progress view ignores total.
This initializer creates a Text view on your behalf, and treats the title similar to init(verbatim:). See Text for more information about localizing strings. To initialize a determinate progress view with a localized string key, use the corresponding initializer that takes a LocalizedStringKey instance.