constant(_:)
Creates a binding with an immutable value.
Declaration
static func constant(_ value: Value) -> Binding<Value>Parameters
- value:
An immutable value.
Discussion
Use this method to create a binding to a value that cannot change. This can be useful when using a PreviewProvider to see how a view represents different values.
// Example of binding to an immutable value.
PlayButton(isPlaying: Binding.constant(true))