Change UITextField width dynamically depends of content
<p>I have the same issue as here: <a href="https://stackoverflow.com/questions/18236661/resize-a-uitextfield-while-typing-by-using-autolayout">Resize a UITextField while typing (by using Autolayout)</a></p>

<p>But It was resolved with <code>UITextView</code> and not with <code>UITextField</code>.</p>

<p>This code doesn't help:</p>

<pre><code>func textFieldDidChange(sender: UITextField) {
    sender.invalidateIntrinsicContentSize()
}
</code></pre>

<p>I have <code>UITextField</code>(red background) and use AutoLayout with StackView:</p>

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

<p>and constraints:</p>

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

<p>but <code>UITextField</code> change it width only when it is <code>resignFirstResponder</code>.
Could you give me please any advice about the issue?
I'm new in Swift and iOS Development. </p>