Skip to content

Instantly share code, notes, and snippets.

@WanderingStar
Last active April 26, 2016 22:57
Show Gist options
  • Save WanderingStar/06b3462e9cf976f6313a2ee381aaa544 to your computer and use it in GitHub Desktop.
Save WanderingStar/06b3462e9cf976f6313a2ee381aaa544 to your computer and use it in GitHub Desktop.
protocol A {}
class B: A {
let v: Int
init(v: Int) { self.v = v }
}
let arr = [B(v: 0), B(v: 1)]
let any: Any = arr
switch any {
case let ehs as [A]:
print("These are As: \(ehs)")
default:
print("Dunno")
}
@WanderingStar
Copy link
Author

I would like this to print "These are As"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment