I am newbie to MAC development. If answer is already explained anywhere, please add link in comments. I will remove the question in that case.
Currently, if textfield length reaches maximum count I'm showing an alert.But, still the last entered character is present in textfield so user needs a backspace.
I also tried using NSFormatter, but failed.
//CODE
override func controlTextDidChange(_ obj: Notification) {
if let textField = obj.object as? NSTextField {
if textField.stringValue.count > x {
// display alert
}
}
}
What I am expecting is that user should enter text, but text should not be displayed. Instead of an alert, text entry shouldn't be allowed like we achieve in web.
Thanks in advance.