Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

What is the Swift constructor for the code below?

NSMakeRange(0, textfield.text!.characters.count)
like image 948
Blazej SLEBODA Avatar asked Oct 11 '17 10:10

Blazej SLEBODA


1 Answers

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

NSRange(location: 0, length: textfield.text!.characters.count)
like image 163
Tamás Sengel Avatar answered Nov 14 '22 17:11

Tamás Sengel