Swift using if on an enum resulting in error not convertible to '_ArrayCastKind'
swift, xcode
Solution
Swift 2.x allows this via the if case pattern match: https://www.natashatherobot.com/swift-2-pattern-matching-with-if-case/
if case let .LoggedIn(name,password) = status {
print( "\(name) Logged in!" )
}
Problem
I'm using Beta 3 of xcode 6, and I am having a problem doing a simple if statement against an enum passed into an argument of a closure. Here is the simple enum definition: ``` enum FLSTeslaLoginStatus { case LoggedOut case LoggedIn case LoggingIn case LoginFailed(NSData!, NSHTTPURLResponse!, NSError) } ``` And the code with the error is: As you can see the switch statement works fine, but the if check is resulting in the error. This is just some test code so I won't normally have a switch and an if statement, but I'm trying to figure out what's wrong with the if statement. I'm thinking it is a compiler bug. This is supported in Swift 2.0 with the use of "if case".