So I want to add done button to my decimalPad so that the user can stop editing. but I need to parse the UITextField to the handleInput function when the done button is pressed. anyone have any ideas if I can parse a UITextField to a objective C function or of there is a better way to do this?
when im doing it like this I get this error:
Argument of '#selector' does not refer to an '@objc' method, property, or initializer
let userInput = UITextField(frame : CGRect(x: 0, y: 0, width: 200, height: 40))
userInput.attributedPlaceholder = NSAttributedString(string: "0.000", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray])
userInput.textColor = UIColor.white
userInput.textAlignment = .right
userInput.tag = units.firstIndex(of: unit)!
userInput.font = UIFont(name: "American Typewriter", size: 20)
userInput.borderStyle = UITextField.BorderStyle.roundedRect
userInput.keyboardType = UIKeyboardType.decimalPad
userInput.returnKeyType = UIReturnKeyType.done
userInput.backgroundColor = UIColor.darkGray
userInput.delegate = self
let toolBar = UIToolbar()
toolBar.sizeToFit()
let flexibleSpaced = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneClicked(userInput)))
@objc func doneClicked(_ textField: UITextField){
view.endEditing(true)
handleInput(textField)
}