Linked list?

The code below works, in that it successfully creates an item and attached it to the parent item, but the parent view doesn't show the new child until you navigate away from the parent and then back to it.

Parent:
  Child1
  Child2
// Add Child 3 and this does not refresh when returning through the dismiss() call, but if I navigate to the grand Parent, and then back to the Parent, Child 3 is there. Any ideas?
		NavigationStack {
			Form {
				LabeledContent {
					TextField("Item", text: $name)
				} label: {
					Text("Item:")
				}
			}
			.navigationTitle("Add New Item")
			.toolbar {
				Button("Save") {
					var tmp = Item(timestamp: Date(), name: name, parent: itemParent)
					if(itemParent != nil) {
						itemParent!.children.append(tmp)
					}
					context.insert(tmp)
					try? context.save()
					dismiss()
				}
			}
		}
Answered by cwt_ in 815844022

Gah! It's because I don't have a query in the view. It's just taking data from the caller.

Accepted Answer

Gah! It's because I don't have a query in the view. It's just taking data from the caller.

Can you share more information? I think I might have run into the same problem.

Linked list?
 
 
Q