Replies: 1 comment 1 reply
-
Hi @grennis, an important aspect of a So, if we decided to resolve the database connection each time the ID was computed (which is what would happen if we used let key = FetchAllKey(…)
key.id // one database connection
withDependencies {
$0.defaultDatabase = DatabaseQueue()
} operation: {
key.id // a different database connection
} And that would mean that the So, the fix is to resolve and capture the database connection at the moment of create the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In episode 310 in the
FetchAllKey
init, (see here) I'm curious why the database is declared as a dependency in the init and then copied to a member variable.Why not just declare
@Dependency(\.defaultDatabase) var database
as a member variable and then nothing is needed ininit
?Beta Was this translation helpful? Give feedback.
All reactions