I've just migrated my code to Swift 4 and it added in lots of @objc
code infront of several functions.
I think I get why after reading lots of posts on here, but my question is this - is there an alternative way of writing this code, that doesn't need to expose the Objective C runtime?
For example:
@objc func textFieldDidChange(textField: UITextField) {
checkCode(textField.text ?? "")
}
Or:
@objc func hideKeyboard() {
commentsBox.resignFirstResponder()
}
Or:
@objc func setDateChanged(_ sender:UIDatePicker) {
setDate.text = dateFormatter.string(from: sender.date)
}
Is there a different way to write this code, that doesn't involve the @objc bit at the start?
Why? I like shorter, cleaner code (which is why I love Swift).
Many thanks in advance!