Delegate mechanism in TCA #2521
Unanswered
JeromeTonnelierOgury
asked this question in
Q&A
Replies: 2 comments 2 replies
-
Hi! |
Beta Was this translation helpful? Give feedback.
0 replies
-
If you allow me, I just comment this post so that it is not forgotten. Any ideas on how to handle delegates external to the TCA framework ? Thanks |
Beta Was this translation helpful? Give feedback.
2 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.
-
Hi everyone :-)
I'm struggling with the implementation of a delegate pattern (external to a framework containing the core TCA feature). I d'ont know if it is a design issue or just a lack of knowledge of TCA, but here I am ^^
I'm building a framework that generates some standalone cards to play some Videos. It generates only some cards, not some card list (important, I'll come back to it later)

Here is a simplistic view of such a card :
So to keep it as simple as possible, I have a CardFeature that pilots the card and all the underlying data and mechanism. It makes the call to the API when loading a Video, it displays it, handles callbacks and stuff.
I have a couple of card and all share a common
ActionBar
(basically it holds the common actions like load and show). So I created a View with a dedicated Reducer and Scope the ActionFeature from the CardFeature when I add the view to the hierarchy. Therefore I can handle the ActionBar.Action inside the CardFeature to load and show Videos. Works great.For the sake of it, here is what it would look like
Ok so far, everything works fine.
Now, I want to use this framework inside an application, and I can't figure out how to handle the deleteButtonTapped from the AppFeature.
I created a MinaFeature whose only responsability is to handle the cards loaded from the framework and display them into a list. And I created an AppFeature (like the one from the
Tour of the Composable Architecture: Domain Modeling
episode) that encapsulates a MainFeature.State as its own non optional root State.I tried to mimic the
Path
example, but I encountered 2 issues :.path(.element(id: _, action: _)
actionBar
Feature State.I guess there are some pretty straightfoward Delegate patterns in TCA, it's just that I don't know them!
Thanks for your help 🙏
Beta Was this translation helpful? Give feedback.
All reactions