The first thing that you need to do is construct the view properly including the main body. When you first create a new SwiftUI view file, it should look like this:
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello, World!")
}
}
You can delete the "Text("Hello, World!")" if you do not need it and then you need to construct the view starting with something like a VStack, HStack, List, Table, etc....
Once that is done you can add the toolbar and your buttons. I have no idea how your data and ToDoItems are constructed so I am just guessing about how to import them and display them in a List but your code should look similar to this:
import SwiftUI
struct ContentView: View {
let data: [Data]
var body: some View {
List(data id: \.self) { item in
Text(item)
}
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button(action: {
data.data.append(TodoItem())
}, label: {
Image(systemName: "plus")
})
}
ToolbarItem(placement: .automatic) {
Button("Filter") {}
}
}
}
}