Saturday, July 16, 2022

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

Issue

Since I converted my code to Swift 3, I got a warning whenever I don't use the result of UITextField's resignFirstResponder() method.

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 ?

Solution

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


Answered By - user28434'mstep
Answer Checked By - Katrina (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.