I want to add a doneToolbar above numberPad to dismiss it when I want, but can't implement it, although I 've seen several tutorials. The code that I 've trying to implement is this:
let toolBar = UIToolbar(frame: CGRect(origin: .zero, size: .init(width: self.frame.size.width, height: 40)))
let flexSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
let doneButton = UIBarButtonItem(title: "Done", style: .done, target: self, action: #selector(dismissNumberPad(_:)))
toolBar.setItems([flexSpace, doneButton], animated: false)
toolBar.sizeToFit()
_textField.inputAccessoryView = toolBar