23.5 Adding a State Property
The slider is going to be used to control the degree to which the Text view is to be rotated. As such, a binding needs to be established between the Slider view and a state property into which the current rotation angle will be stored. Within the code editor, declare this property and configure the Slider to use a range between 0 and 360 in increments of 0.1:
struct ContentView: View {
@State private var rotation: Double = 0
var body: some View {
VStack {
VStack {
Text("Hello, world!")
Slider(value: $rotation, in: 0 ... 360, step: 0.1)
...