#62: Protocol Existentials with any in Swift

The any keyword makes protocol existentials explicit.

let value: any CustomStringConvertible = 42
print(value.description)

This means the variable can store any concrete type that conforms to the protocol.

That flexibility is useful, but it is different from some: any hides the concrete type, while some still commits to one concrete type chosen by the implementation.


I'm also on Twitter and GitHub.

Subscribe via RSS.