Discussion 解説
The base
property can be cast back to its original type using one of the type casting operators (as?
, as!
, or as
).
base
プロパティは、それの元の型へキャストされて戻されることが型キャスト演算子(as?
、as!
、またはas
)を使って可能です。
let anyMessage = AnyHashable("Hello world!")
if let unwrappedMessage = anyMessage.base as? String {
print(unwrappedMessage)
}
// Prints "Hello world!"