How can I convert NSRange to Range in Swift?
NSRange
Range
I want to use the following UITextFieldDelegate method:
UITextFieldDelegate
extension StringProtocol where Index == String.Index { func nsRange(of string: String) -> NSRange? { guard let range = self.range(of: string) else { return nil } return NSRange(range, in: self) } }