Randy Randy - 1 year ago 190
Swift Question

How to get rid of warning "Result of call 'resignFirstResponder()' is unused"?

Since I converted my code to

Swift 3
, I got a warning whenever I don't use the result of

enter image description here

There's no bugs ( at least for now ) but I don't really like to have warnings like that. So my questions:

  • Should I actually use the results of this kind of call ? And if the answer yes, what should I do with them ?

  • If the answer is no : how can I get rid of these warnings ?

Answer Source

As Shaggy D already said this warnings can be ignored safely.

If you don't want to see them at all in your project you may set GCC_WARN_UNUSED_VALUE to false/NO in Build Settings.

Or just add let _ = before resignFirstResponder():

let _ = resignFirstResponder()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download