struct Gg: Identifiable{
let id: Int
let task: String
}
struct ContentView: View {
@State private var items = [Gg(id: 1, task:"take the trash out"), Gg(id: 2, task:"Go for a run")]
var body: some View {
AddTaskUIView(title: "Add Item", isShown: $isPresented, text: $text, onDone: { text in
self.items.append(text)
self.text = ""
})
}}
我收到一个错误
无法将“String”类型的值转换为预期的参数类型“Gg”
如何附加到结构 Gg 的任务?我是 swift 新手,所以我会给予任何帮助,谢谢。