Need to dynamically generate UITableView items from JSON. What is the best approach? : <p>Lets say I have an array of JSON objects like this:</p>

<pre><code>{
  "views": [
    {
    "type": "UILabel",
    "data": "Here is a headline",
    "id": "label1"
    },
    {
    "type": "UIImage",
    "data": "http://doge2048.com/meta/doge-600.png",
    "id": "image1"
    },
    {
    "type": "UIButton",
    "data": "Click me",
    "id": "button1"
    }
  ]
}
</code></pre>

<p>This is how this item should look like for example.
<a href="https://i.stack.imgur.com/XvTtT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XvTtT.png" alt="This is how this item should look like for example."></a></p>

<ul>
<li>Each table cell will have different JSON, so I can't design them in Storyboard.</li>
<li>Dynamic views can even be UIStackViews, so I can't just create a main UIStackView and add these in it. (Because it lags very bad.)</li>
<li>Data source and structure is not a problem. My question is how to construct the UI and constraints.</li>
</ul>
