---
title: "constant(_:)"
framework: swiftui
role: symbol
role_heading: Type Method
path: "swiftui/binding/constant(_:)"
---

# constant(_:)

Creates a binding with an immutable value.

## Declaration

```swift
static func constant(_ value: Value) -> Binding<Value>
```

## Parameters

- `value`: An immutable value.

## Discussion

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))

## See Also

### Creating a binding

- [init(_:)](swiftui/binding/init(_:).md)
- [init(projectedValue:)](swiftui/binding/init(projectedvalue:).md)
- [init(get:set:)](swiftui/binding/init(get:set:).md)
