I have a UITextField that I\'m forcing formatting on by modifying the text inside the change notification handler. This works great (once I solved the reentranc
Here's the Swift version of @Chris R. – updated for Swift3
private func selectTextForInput(input: UITextField, range: NSRange) {
let start: UITextPosition = input.position(from: input.beginningOfDocument, offset: range.location)!
let end: UITextPosition = input.position(from: start, offset: range.length)!
input.selectedTextRange = input.textRange(from: start, to: end)
}