'scanLocation was deprecated in iOS 13.0'

I have this code giving me the deprecated warning. How do I fix this?:

// Retrieve the unscanned remainder of the string

if textScanner.scanLocation < textScanner.string.count {

textToScan = (textScanner.string as NSString).substring(from: textScanner.scanLocation + 1)

}
'scanLocation was deprecated in iOS 13.0'
 
 
Q