An interesting thing about '!=' in Swift
I’ve been programming in Swift today.
Coming from a C/Objective-C background, I assumed the following code would work:
// won't compile
if (someVar!=nil) {
...
}
It won’t work; the compiler must sees it as something like someVar! = nil
due to optional chaining.
Instead, you have to write
if (someVar != nil) {
...
}