Suppose I have String like :
var abc : NSString = \"ABC\"
and I want to check that it is nil or not and for that I try :
if
Swift 4 You cannot compare Any to nil.Because an optional can be nil and hence it always succeeds to true. The only way is to cast it to your desired object and compare it to nil.
if (someone as? String) != nil { //your code`enter code here` }