@OOPer, the behavior of TextEditor is expected, but as you see, I created a @State variable to store the input of Users so I need to update the instance of EnvironmentObject with the @State variable . I tried to put the instance of EnvironmentObject directly into the TextEditor but it cannot compile with an error:
Failed to produce diagnostic for expression; please file a bug report
swift
TextEditor(text: $UserData.NoteList[label ?? ""][id ?? 0].title ?? $title)
.font(.title2)
.padding(.top)
.padding(.horizontal)
.frame(height: 50, alignment: .center)
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: