I am trudging through the doc on the seemingly endless ways to expose model data through a view hierarchy.
The Apple doc here provides this example:
struct BookReaderApp: App {
@State private var library = Library()
var body: some Scene {
WindowGroup {
LibraryView()
.environment(\.library, library)
}
}
}
Why would you do this? Is the Library at risk of being repeatedly destroyed and re-created? Also, Library is defined as an Observable class, not a struct. So why is it @State and not @StateObject?