How to create recursive state

I really like the idea of the TCA. So last week I give it a try. But there is one situtation that I can't get my head around.

My understanding is TCA builds parent-child relationship between domains. So it is really easy to create hierarchy like this: Search -> Product Detail -> Releated Products. SearchState embeds ProductDetailState and ProductDetailState embeds ReleatedProductsState.

Here is the part that I don't understand. Say you need to display Search from Releated Products. And domain hierarchy becomes recursive like this: Search -> Product Detail -> Releated Products -> Search -> Product Detail -> Releated Products ..... In swift structs can not become recursive.

So how can I model this in TCA?


I have found a workaround for this issue I have been struggling for a long time.

Here is an example with two views First and Second. The views can go infinite times forward FirstView -> SecondView -> FirstView -> SecondView -> ....

Example code here


Nice solution!!! thank!

Terms of Service

Privacy Policy

Cookie Policy