Randy Randy - 15 days ago 5
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 ?


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()