Some SwiftUI controls not working

I am learning to code in swift on my iPad using playgrounds. I was progressing along well, using the blank page, when some of the controls stopped working. For example the slider was working beautifully. Then (maybe after the latest iPad iOS update), the slider stopped functioning. After pressing run the slider appears as expected. I can slide but the value doesn’t change.
The stepper and the toggle stopped working as well, in the same way.
The button control is working fine as is text.

Surprisingly they all work on the shapes page. This also solved another problem - it runs on a full page.
I will paste the code I used below in case someone can help.

import SwiftUI
import PlaygroundSupport
import SceneKit
struct ContentView: View {
@State var sliderValue: Double = 0
var body: some View {
VStack {
Slider(value: $sliderValue, in: 0...20)
Text("Current slider value: (sliderValue, specifier: "%.2f")")

Aside from the missing \ in the Text string, code works on my iOS Playground (3.4) just fine. You may also have better luck asking over


You could put the code block in triple tick marks

Like this

So the it gets rendered

Like this

Hi Lantua
Thanks for the reply.
Unfortunately that didn't work, although it did change things. You slid \ (slide) appeared under the slider. When I used the slider nothing happened.
I didn't find your tick marks.
I will put a photo underneath to show what happened.

You need only one \, so it should be

Text("Your slide: \(slide)")

That depends on your keyboard layout. Most that I know of have them next to 1. No matter, you could do what I do, and copy them as needed and/or set them as a keyboard shortcut.

Hi again, I am testing your patience.
That put me back to where I was. The value under the slider stays as its initial value, 0. Sliding doesn’t doesn’t change it.
I copied your tick marks and tried them in a few places but they gave an error.

Try to click on the gauge symbol (to the left of start/stop button) and turn off "enable result". That stalls the program significantly, and sometimes does funny things to the view rendering.

I meant that you can use the tick mark on this forum so that it's easier to read the code you post (on this forum). You don't use tick marks on the Playground app.

Thanks. Turning off the “enable result” did the trick. The slider and stepper controls now work.
Apologies. I must have left off the forward slash in my first correspondence, hence wasting your time.

No worries. Though I need to say that Apple's private framework, like SwiftUI and UIKit are actually off-topic for this forum. Once you dig deeper into SwiftUI and have some SwiftUI-specific questions, I'd suggest that you ask over instead.

I thought SwiftUI was what the forum was for. I’m not having much trouble with the swift language.

Terms of Service

Privacy Policy

Cookie Policy