Different layouts for row detail view in the same table view

Here is how I go about this if I understand your question:
I create my own expand button where I use a switchif to decide which view will open. I keep a different table for each view I want and have the switch if open the desired view.

Screen Shot 2023-10-23 at 2.10.04 PM