How to build a dynamic UI in Swift/Xcode?
<p>I have to build an app where I need to display UI elements according to the info I get from a database.</p>

<p>I have a TabelView with a custom cell which has a label and I have some text there from the database. This works. 
Now In the database for each cell I store this text and I have a column for other UI elements. For example if this column has 1 then I have to display a Button under the Label, if this column stores 2 then I have to display a DataPicker under the Label. 3 - Switch, 4 - Slider, 5 etc.</p>

<p><strong>Is it a good solution to put all the UI elements in the prototype cell IN A STACK VIEW, set the height to dynamic and always display (hide = true/false) the proper UI element?</strong></p>

<p>But if I have 10-12 different UI elements it can become messy and too long. So what's the best solution for this? </p>