Hi,
When I add the following to AddItemViewController.swift, I have on the line “let stringRange = Range(…)” the “Expected expression after operator”. I don’t get why. I compared with the files from the book, still don’t catch the mistake.
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let oldText = textField.text !
let stringRange = Range(range, in:oldText)!
let newText = oldText.replacingCharacters(in: stringRange, with: string)
if newText.isEmpty {
doneBarButton.isEnabled = false
}else {
doneBarButton.isEnabled = true
}
return true
}
Any ideas ?