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

1

21

What is the Swift constructor for the code below?

NSMakeRange(0, textfield.text!.characters.count)
Argeliaargent answered 11/10, 2017 at 10:20 Comment(1)
Possible duplicate of Difference between NSRange and NSMakeRangeAmuse
N
40

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

NSRange(location: 0, length: textfield.text!.characters.count)
Nierman answered 11/10, 2017 at 10:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.