I believe the problem is a bug in the .toolbar where items will not show up. If you replace Apple's default code and use .navigationBarItems (instead of .toolbar) you'll be able to see the buttons so you can add items to the CoreData list. Replace the default View body code with this and it should work for you.
var body: some View {
NavigationView {
List {
ForEach(items) { item in
Text("Item at \(item.timestamp!, formatter: itemFormatter)")
}
.onDelete(perform: deleteItems)
}
.navigationBarItems(leading: EditButton(),
trailing: Button(action: addItem, label: { Label("Add Item", systemImage: "plus") })
)
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: