diff --git a/Caps/ContentView.swift b/Caps/ContentView.swift index b821ce6..46d6a4d 100644 --- a/Caps/ContentView.swift +++ b/Caps/ContentView.swift @@ -245,7 +245,7 @@ struct ContentView: View { SettingsView(isPresented: $showSettingsSheet) } .sheet(isPresented: $showGridView) { - GridView(isPresented: $showGridView) + GridView(isPresented: $showGridView, database: database) }.alert(isPresented: $showNewClassifierAlert) { Alert(title: Text("New classifier available"), message: Text("Classifier \(database.serverClassifierVersion) is available. You have version \(database.classifierVersion). Do you want to download it now?"), diff --git a/Caps/Views/GridView.swift b/Caps/Views/GridView.swift index 85ba0f8..7aeac8d 100644 --- a/Caps/Views/GridView.swift +++ b/Caps/Views/GridView.swift @@ -3,8 +3,7 @@ import SFSafeSymbols struct GridView: View { - @EnvironmentObject - var database: Database + let database: Database @AppStorage("currentGridName") @@ -36,8 +35,9 @@ struct GridView: View { @State var lastScaleValue: CGFloat = 1.0 - init(isPresented: Binding) { + init(isPresented: Binding, database: Database) { self._isPresented = isPresented + self.database = database self.image = .init(columns: 1, capPlacements: []) if let image = database.load(grid: currentGridName) { @@ -165,7 +165,6 @@ struct GridView: View { struct GridView_Previews: PreviewProvider { static var previews: some View { - GridView(isPresented: .constant(true)) - .environmentObject(Database.largeMock) + GridView(isPresented: .constant(true), database: .largeMock) } }