this code:
guard let isNotNil = anOptional
else {
#if DEBUG
fatalError()
#endif
return false
}
gives a compiler warning when in debug mode on return false
:
Will never been executed
Which is right but by intention.
How can I suppress this warning?
With an else statement:
guard let isNotNil = anOptional
else {
#if DEBUG
fatalError()
#else
return false
#endif
}
You can also go to the project or the target build settings and disable the warning for unreachable code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.