is there is a way to negate the \"if let\" in swift? This looks silly to me:
if let type = json.type {
} else {
XCTFail(\"There is no type
Another alternative I've used a few times:
switch json.type
{
case .None: // ...
case .Some(.Object): // ...
case .Some(.Array): // ...
case .Some(.Number): // ...
case .Some(.String): // ...
}
Since the ? is actually Optional which is an enum on its own, defined as:
enum Optional : Reflectable, NilLiteralConvertible
{
case None
case Some(T)
...
}