[ad_1]
So I’ve a State var known as calmnote that’s outlined as a string on this struct known as calmEdit. I primarily have to set the worth of calmNote to the worth of content material acquired by an Observable Object known as calmManager.
struct calmEdit : View {
@StateObject var CalmManager = calmManager()
@Surroundings(.dismiss) var dismiss
@State var calmNote: String = ""
@ViewBuilder
var physique: some View {
EmptyView()
ForEach(CalmManager.calmDoccs) { calmDoccs in
self.calmNote = calmDoccs.content material as! String ?? "" // Error: Kind '()' can't conform to 'View'
TextEditor(textual content: $calmNote)
.padding(.high, 0)
.padding(.main, 10)
.padding(.trailing, 10)
Button( motion: {
CalmManager.updateCalmTheme(calmContent: calmNote, id: idcalm)
}) {
Label("Save", systemImage:"") }
.accentColor(colorScheme == .darkish ? Colour.pink : Colour.pink)
.padding(10)
}}
}
Now if I take away the self.calmNote = calmDoccs.content material as! String ?? " line i do not get any error, however then once more, I will not be capable to set the worth of the var calmNote to calmDoccs.content material. Does anybody understand how I can obtain this by not getting this error?
Thanks prematurely.
[ad_2]
