swift: programmatically create UILabel fixed width that resizes vertically according to text length
<p>I've seen answers to vertical resizing that involve autolayout, but the <code>UILabel</code>s I'm creating are only needed at runtime. (I might need anywhere from zero to many of these labels.)</p>

<p>Examples (ignore the color)</p>

<ol>
<li>Short text (note same width as longer text):</li>
</ol>

<p><a href="https://i.stack.imgur.com/lzrZ7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lzrZ7.png" alt="enter image description here"></a></p>

<ol start="2">
<li>Longer text (note same width as shorter text example with more lines for add'l text):</li>
</ol>

<p><a href="https://i.stack.imgur.com/1Baoo.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1Baoo.png" alt="enter image description here"></a></p>

<p>If the text can fit in one line of fixed width, the label shouldn't need to resize vertically. But if there are more characters, the label should keep expanding vertically to fit these additional characters. The text should keep wrapping around line after line. The text should start in the top left corner of the label.</p>

<p>To be more specific:</p>

<pre class="lang-swift prettyprint-override"><code>let marker = GMSMarker(position: myLatLng)
// see http://stackoverflow.com/a/40211383/1168364 for imageWithView
marker.icon = imageWithView(label) // **how do i create this label?**
marker.map = map // map is a GMSMapView
</code></pre>

<p><strong>These labels can be anywhere on the screen. This is for a map application where each label will be placed at a random location. The labels' locations have no relationship to one another.</strong></p>