following code in func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) causing this error:Command failed due to signal: Segmentation fault: 11 cause
var finalStr = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if textfield == mobile && finalStr.hasPrefix("0"){
textField.text = finalStr.nonZeroNumber
return false }
var nonZeroNumber:String{
let local = Double(self)
return String(format: "%.0f",local!)
}
what's wrong with the code, as its working fine in the sample project.