Xcode15 beta 5 - I can't have multiple TextEditor in the same view (Preview only)

If I have the code below and do the following with preview on:

  1. Choose one of the TextEditors and start typing: works
  2. Go to another one. Start typing, the text shows only in the first one you chose.
  3. Try to delete the text while on the second (or third, or fourth) and you can't.
  4. Try to delete the text in the first one. It works. >.<

If you check the preview console, you will see that the first variable is used forever.

Is anyone having the same problem? So annoying having to run everything every single time.

I'm running the Xcode on Sonoma 14.0.

import SwiftUI

struct TextStruct {
    var text1: String = "text1"
    var text2: String = "text2"
}

struct TextSummaryEditorView: View {
    
    @State private var textForSummary: String = "textForSummary"
    
    @State private var boomshakalaka: String = "boomshakalaka"
    
    @State private var textstruct: TextStruct = TextStruct(text1: "boo1", text2: "boo2")
    
    var body: some View {
        VStack {
            VStack {
                Text(textForSummary)

                TextEditor(text: $textForSummary)
                    .textFieldStyle(PlainTextFieldStyle())
                    .font(.system(size: Config.defaultFontSize))
                    .padding()
                    .background(Color("background").opacity(0.9))
                    .lineSpacing(10)
                    .zIndex(1)
                    .multilineTextAlignment(.leading)
                
                Text(boomshakalaka)
                TextEditor(text: $boomshakalaka)
                    .textFieldStyle(PlainTextFieldStyle())
                    .font(.system(size: Config.defaultFontSize))
                    .padding()
                    .background(Color("background").opacity(0.9))
                    .zIndex(0.9)
                
                Text(textstruct.text1)

                TextEditor(text: $textstruct.text1)
                    .textFieldStyle(PlainTextFieldStyle())
                    .font(.system(size: Config.defaultFontSize))
                    .padding()
                    .background(Color("background").opacity(0.9))
                    .lineSpacing(10)
                    .zIndex(1)
                    .multilineTextAlignment(.leading)
                
                Text(textstruct.text2)
                TextEditor(text: $textstruct.text2)
                    .textFieldStyle(PlainTextFieldStyle())
                    .font(.system(size: Config.defaultFontSize))
                    .padding()
                    .background(Color("background").opacity(0.9))
                    .zIndex(0.9)
                
            }
            .cornerRadius(Config.radioL)
            .onChange(of: boomshakalaka) {
                print(boomshakalaka)
            }
            Text("Button")
        }
    }
}

struct TextSummaryEditorView_Previews: PreviewProvider {
    static var previews: some View {
        VStack {
            TextSummaryEditorView()
        }
        .padding()
        .background(Color("background").opacity(0.4))
    }
}```

thanks for providing a feedback report for this issue too. I'll make sure it gets to the right team for triaging as soon as possible

Xcode15 beta 5 - I can't have multiple TextEditor in the same view (Preview only)
 
 
Q