title: Using stringByReplacingCharactersInRange in Swift
body: <p>I'm trying to use UITextFieldDelegate in Swift/Xcode6 and I'm struggling with the way I'm supposed to use stringByReplacingCharactersInRange. The compiler error is 'Cannot convert the expression's type 'String' to type '$T8'.</p>
  
  <pre><code>func textField(textField: UITextField!, shouldChangeCharactersInRange range: NSRange, replacementString string: String!) -&gt; Bool
  {
      let s = textField.text.stringByReplacingCharactersInRange(range:range, withString:string)
      if countElements(s) &gt; 0 {
  
      } else {
  
      }
      return true
  }
  </code></pre>
  
  <p>Update for Xcode 6 Beta 5: The thing is shouldChangeCharactersInRange gives an NSRange object and we'd need a Swift Range object for stringByReplacingCharactersInRange. Can this still be considered a bug as I don't see why we should still be dealing with NS* objects? The String argument of the delegate method is anyway of a Swift type.</p>