Quantcast
Channel: Is it safe to force unwrap an optional after checking it is not nil - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by Papershine for Is it safe to force unwrap an optional after...

The difference between if and guard is just simple, but in your case, you should use if, not guard. guard should be used when some values are expected to be present for the function to execute as...

View Article



Is it safe to force unwrap an optional after checking it is not nil

I have a network method that return me a completion closure with an Error as the parameter.I usually avoid force unwrapping, but in that case, I use a guard statement to check if error is not nil:guard...

View Article
Browsing all 2 articles
Browse latest View live


Latest Images