What is the best way to execute code if any additional parameter is non-zero? Obviously, the most obvious way to do this would be to directly check if nil is equal:
if optionalValue != nil {
}
I also saw the following:
if let _ = optionalValue {
}
The second seems to be more likely to be fast, since it uses an optional chain. Are there any advantages to using one method over another? Is there a better way to do this? For the better, I mean "more according to Swift," whatever that means.
source
share