title: IOS Swift - Manually trigger textfield events
body: <p>How do I trigger the events manually given the UITextField object?</p>
  
  <pre><code>textFieldShouldBeginEditing(_:)
  textFieldDidBeginEditing(_:)
  textFieldShouldEndEditing(_:)
  textFieldDidEndEditing(_:)
  </code></pre>
  
  <p>In the current scenario. There is some logic which goes into the above callbacks. And there are times when I manually update a textfield</p>
  
  <pre><code>textfield.text = &lt;new text&gt;
  </code></pre>
  
  <p>And I would like the </p>
  
  <pre><code>textFieldDidBeginEditing
  </code></pre>
  
  <p>to be trigger, like (hopefully)</p>
  
  <pre><code>textfield.trigger("textFieldDidBeginEditing")
  </code></pre>
  
  <p>While my approach might not be entirely the right way, the above solution is what would most likely works for me. Although, If I can word my question differently, it would be:</p>
  
  <ul>
  <li><strong>How can I run some logic (code) when a UITextFields value (text) is changed via the UI or via</strong> <code>textfield.text = &lt;new value&gt;</code></li>
  </ul>