Hi, Everyone,
I have two questions about the Optional in swift 4.1, here is the code for the first one.
let a: String! = "hello, world"
let c: Any = a
print(c)
in Swift 4,
the above code result is "hello, world"
but in Swift 4.1,
the above code result is some("hello, world")
does swift 4.1 change something for the Optional ?
And the second.
let a: String! = "hello, world"
let c: Any = a
print(c)
switch c {
case Optional.some(let value):
print(value)
case Optional.none: // Case is already handled by previous patterns; consider removing it
print(c)
}
When I try to use switch/case for Optional as the code above, I have the warning message,
**Case is already handled by previous patterns; consider removing it. **
but the second case is obviously not handled by the previous patterns, is this normal, or am I miss something.
Best Regards.