18

What is the Swift constructor for the code below?

NSMakeRange(0, textfield.text!.characters.count)
Jay
  • 686
  • 1
  • 4
  • 16
Blazej SLEBODA
  • 8,936
  • 7
  • 53
  • 93
  • 1
    Possible duplicate of [Difference between NSRange and NSMakeRange](https://stackoverflow.com/questions/44522626/difference-between-nsrange-and-nsmakerange) – Cœur Mar 22 '18 at 08:59

1 Answers1

37

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

NSRange(location: 0, length: textfield.text!.characters.count)
Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223