Yes, you are doing something (in fact several things) wrong. But to tell you what, you should show the complete Rosa structure.
However, some problems:
@State private var selezioneGiocatore: Rosa.ID? = nil
Selection must be a Set, as
@State private var selezioneGiocatore: Set<Rosa.ID> = []
TableColumn(Text("Età").foregroundStyle(.blue)) {
Rosa in
Text("\(Rosa.etàGiocatore)")
}
Using the structure name (Rosa) as the argument of the closure is incorrect.
Rosa.testRosa().append(nuovoGiocatore)
How is testRosa defined ? Seems to be a func ? append is trying to modify the structure, which is forbidden.
You should call it on an instance as:
var rosa = Rosa.testRosa()
rosa.append(nuovoGiocatore)
So please show complete code.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: