Small addendum to my previous code question, how do I use an @​Observable as a binding if the object I want to bind is optional? In this case, the object might not be immediately available as it comes in async, but once it comes in, I want it selectable

This code compiles, but the selection is never saved

There's probably a better way to structure this too, in that case I'm all ears!

Gist: https://gist.github.com/christianselig/792257d1270f0c6dd3ebd9fde062ed51

icecreamobserving.swift

GitHub Gist: instantly share code, notes, and snippets.

Gist
@christianselig Are you aware of „Bindable“? You can also define a Bindable var inside your body callback to access stuff from the environment. https://developer.apple.com/documentation/swiftui/bindable
Bindable | Apple Developer Documentation

A property wrapper type that supports creating bindings to the mutable properties of observable objects.

Apple Developer Documentation
@maxmelzer How would I use it in this situation? I've tried a few different incantations to no avail
@christianselig Ah, sorry, I see you already got that info. Thanks for the small puzzle, though! :)