Replies: 1 comment 5 replies
-
You can kinda think of We have an example of using this in the long-living effect case study, where we erase the The biggest caveat is that |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey all,
Perhaps slightly off topic, but I think it's on-topic to how dependencies are typically defined when using TCA.
Just wondering if anyone has a dependency which returns an
AsyncSequence
, and if so, how you're handling the fact it's missing a primary associated type?For example, I'm using GRDB as my database layer in this application. There's a certain table, say of
Player
types, that I want to observe. So in myDatabaseManager
type, I would implement myobservePlayers
method like this:However, this returns a GRDB specific type -
AsyncValueObservation<Player>
. Obviously, I don't want any GRDB types to bleed into myDatabaseManager
interface, as I don't want to be building GRDB each time I build my non-liveDatabaseManager
implementation (even though it's a small dependency and doesn't take long to build).If I was doing this with Combine (which I probably will go back to), the type for my
observePlayers
method would be@Sendable () -> AnyPublisher<[Player], Error>
. Ideally, I'd like to do quite similar withasync
/await
instead of Combine.Is there a way around this? How are you designing
AsyncSequence
-returning dependencies?Beta Was this translation helpful? Give feedback.
All reactions