Dose anyone know why the following code just will not work? I al going crazy trying to work it out! Any help would be most appreciated. thanks

func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
    var length = (count(textField.text) + count(string))
        
        if(length > 1)
    {
         return false
    }
      else
    
    {
     return true
    }
        
    }