Thanks for this suggestion, I'll experiment with it. I will probably end up using my current workaround of handling the optional in the root view and returning an EmptyView if it's nil, because in my actual app (as opposed to the example I shared), the object is somewhat large and has several properties that don't have obvious default values. But the EnvironmentKey approach seems like a good alternative.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: