title: iOS 13 Crash with SwipeKeyboard and textfield:shouldChangeCharactersIn:
body: <p>In iOS 13, when implementing <code>shouldChangeCharactersIn</code> via the <code>UITextfieldDelegate</code>, the application crashes when using the swiping keyboard. </p>
  
  <pre><code>    func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -&gt; Bool {
          if let text = textField.text as NSString? {
              let txtAfterUpdate = text.replacingCharacters(in: range, with: string)
              textField.text = txtAfterUpdate
          }
          return false
      }
  </code></pre>
  
  <p>Is this an Apple bug?</p>