Fix crash al abrir Import Data en Mac Catalyst (@EnvironmentObject no heredado en sheets)
ImportDataView usa @EnvironmentObject (iapService/accountStore/tabSelection). En Mac (Designed for iPad) las sheets no heredan el environment vía PresentationHostingController → EnvironmentObject.error() / SIGTRAP al abrir Import Data (ImportDataView.swift:247, shouldShowAccountSelection). Reinyectados los 3 objects en las sheets de Settings, Dashboard y Onboarding. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L2p3gUZRNWW388rWFRjiU7
This commit is contained in:
@@ -6,6 +6,7 @@ import TipKit
|
||||
struct DashboardView: View {
|
||||
@EnvironmentObject var iapService: IAPService
|
||||
@EnvironmentObject var accountStore: AccountStore
|
||||
@EnvironmentObject var tabSelection: TabSelectionStore
|
||||
@StateObject private var viewModel: DashboardViewModel
|
||||
@StateObject private var goalsViewModel = GoalsViewModel()
|
||||
@State private var showingImport = false
|
||||
@@ -110,7 +111,12 @@ struct DashboardView: View {
|
||||
goalsViewModel.refresh()
|
||||
}
|
||||
.sheet(isPresented: $showingImport) {
|
||||
// Re-inject env objects: sheets don't inherit @EnvironmentObject on
|
||||
// Mac Catalyst (Designed for iPad) → ImportDataView crashed on open.
|
||||
ImportDataView()
|
||||
.environmentObject(iapService)
|
||||
.environmentObject(accountStore)
|
||||
.environmentObject(tabSelection)
|
||||
}
|
||||
.sheet(isPresented: $showingAddSource) {
|
||||
AddSourceView()
|
||||
|
||||
Reference in New Issue
Block a user