How can I convert NSRange
to Range<String.Index>
in Swift?
I want to use the following UITextFieldDelegate
method:
func textField(textField: UITextField!,
shouldChangeCharactersInRange range: NSRange,
replacementString string: String!) -> Bool {
textField.text.stringByReplacingCharactersInRange(???, withString: string)