I have a RealityView that is an earth globe, where I'm adding attachments and also updating how attachments appear, depending on user input.
I pass a @Binding var annotations: [MyAnnotation] to my view which has a RealityView as its main body. The annotations are displayed fine using the SwiftUI views defined in the annotations handler, but they do not update when the annotations in that binding are updated.
My attachments: handler looks like this:
RealityView { ...
} attachments: {
ForEach($annotations) { $attachment in
AttachmentView(attachment: $attachment)
.tag(attachment.id)
}
}
I also tried without the $ syntax there. Neither leads to an update of the AttachmentView. Curiously the update handler also isn't called when the annotations are updated.
I also tried settings a different .id on the entire thing, but even then it's just using my AttachmentView as initially configured.
I'm very puzzled by this and would appreciate help. Am I holding this wrong, or is this a bug?
1
0
959