NSRange to Range

前端 未结 13 1215
失恋的感觉
失恋的感觉 2020-11-22 11:59

How can I convert NSRange to Range in Swift?

I want to use the following UITextFieldDelegate method:

13条回答
  •  伪装坚强ぢ
    2020-11-22 12:39

    As of Swift 4 (Xcode 9), the Swift standard library provides methods to convert between Swift string ranges (Range) and NSString ranges (NSRange). Example:

    let str = "a

提交回复
热议问题