This is not allowed (bad expression)
if !(let nsDictionaryObject = swiftObject as? NSDictionary)
{
"Error could not make NSDictionary in \(self)"
return
}
Is it possible to check for the negative of an Optional Chain expression in 1 line?
In Swift 1 you could, for instance, use the
else
branch or check for anil
result.In Swift 2.0, you can use
This will also bind
nsDictionaryObject
to the scope outside the guard statement.If you are using swift 1.2 you can do it this way: