lint Legacy Constructor Violation: (legacy_constructor) NSMakeRange in Swift?

What is the Swift constructor for the code below?

NSMakeRange(0, textfield.text!.characters.count)

1 answer

  • answered 2017-10-11 10:22 the4kman

    The modern Swift constructor for this is NSRange(location:length:).

    NSRange(location: 0, length: textfield.text!.characters.count)