1

Just converted to Swift 4. On my project I have a warning that says the following

Argument of '#selector' refers to instance method 'dismissKeyboard()' in 'UIViewController' that depends on '@objc' inference deprecated in Swift 4

for the following code

let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(EntryViewController.dismissKeyboard))

My browsing of similar issues suggests adding @objc before the line, but Xcode then puts an error and the fix deletes it.

Any suggestions

RubberDucky4444
  • 2,330
  • 5
  • 38
  • 70

1 Answers1

3

Put @objc not on the line that calls dismissKeyboard, but rather on the declaration of func dismissKeyboard itself, and you will solve your issue.

Charles Srstka
  • 16,665
  • 3
  • 34
  • 60