Environment injection
In a SwiftUI app you injected .environment(session) at an intermediate view (HomeView) as shown below. ProfileView, which uses @Environment(Session.self) var session, works fine when pushed inside the NavigationStack but crashes at runtime when presented from HomeView's .sheet. What's the most likely cause?
NavigationStack {
HomeView() // presents .sheet { ProfileView() } internally
}
.environment(session) // assume it's injected here, not at the rootPick one