Defined the Todo model in the app target.
This commit is contained in:
@@ -7,7 +7,7 @@ struct ContentView: View {
|
||||
private var modelContext
|
||||
|
||||
@Query
|
||||
private var items: [Item]
|
||||
private var items: [Todo]
|
||||
|
||||
var body: some View {
|
||||
NavigationSplitView {
|
||||
@@ -43,7 +43,7 @@ struct ContentView: View {
|
||||
|
||||
private func addItem() {
|
||||
withAnimation {
|
||||
let newItem = Item(timestamp: Date())
|
||||
let newItem = Todo(title: "New Todo", due: Date())
|
||||
modelContext.insert(newItem)
|
||||
}
|
||||
}
|
||||
@@ -59,5 +59,5 @@ struct ContentView: View {
|
||||
|
||||
#Preview {
|
||||
ContentView()
|
||||
.modelContainer(for: Item.self, inMemory: true)
|
||||
.modelContainer(for: Todo.self, inMemory: true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user