title: Max Character Limit for TextField
body: <p>I am looking to cap the amount of characters a user can type into a textfield at 14. Here is the code that I have found documentation on.</p>
  
  <pre><code>func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -&gt; Bool {
  
      let currentCharacterCount = userNameTextField.text?.characters.count ?? 0
      if (range.length + range.location &gt; currentCharacterCount){
          return false
      }
      let newLength = currentCharacterCount + string.characters.count - range.length
      return newLength &lt;= 14
  }
  </code></pre>
  
  <p>but I do not feel that I am implementing this correctly. I have set</p>
  
  <pre><code>userNameTextField.delegate = self 
  </code></pre>
  
  <p>in the viewDidLoad, and I am conforming to the <code>UITextFieldDelegate</code> protocol.</p>