Skip to content

Commit b605271

Browse files
committed
Add SwiftUI binding constants
1 parent 0b0a145 commit b605271

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Apple/SwiftUI.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,3 +657,19 @@ struct SomeView_Previews: PreviewProvider {
657657
}
658658
}
659659
```
660+
661+
## Create immutable binding values
662+
663+
```
664+
Binding.constant(someValue)
665+
```
666+
667+
For example:
668+
669+
```swift
670+
struct SomeView_Previews: PreviewProvider {
671+
static var previews: some View {
672+
Toggle("Some label", isOn: .constant(true))
673+
}
674+
}
675+
```

0 commit comments

Comments
 (0)