Weird bug about Toggle

Hello guys!

I find a weird bug when using Toggle.

I made a lot tests and the simplified code below:

struct ContentView: View {
    @State var toggle = false
    var body: some View {
        VStack {
            Toggle(isOn: $toggle) {

I don't know whether you'll reproduce this bug, the code above will make the toggle become invalid.

If I delete the cornerRadius or Text("Test") below Toggle, the toggle will works again.

Funny that I don't notice anything wrong with the behaviour, in simulator, preview, or actual iPhone (iOS 13.1).

The toggle toggles when I click on it. If I print the value of toggle, it is always true when the Toggle is green and false otherwise.

I (again) use Xcode 11.1 (11A1027) on Catalina (10.15) with iOS 13.0 as target.

1 Like

I've update my Xcode to 11.1 and it works perfect now. Thanks a lot!

Terms of Service

Privacy Policy

Cookie Policy