Any can represent an instance of any type at all, including function types.
Any 也可以代表可选性, 如下代码, 说得通, 但不应该.
var a: Int?
let b = a as Any
if b != nil {
print("b != nil, b == \(b)")
}
// print
b != nil, b == nil
reference: TypeCasting
Any can represent an instance of any type at all, including function types.
Any 也可以代表可选性, 如下代码, 说得通, 但不应该.
var a: Int?
let b = a as Any
if b != nil {
print("b != nil, b == \(b)")
}
// print
b != nil, b == nil
reference: TypeCasting
本文标题:Swift Any
本文链接:https://www.haomeiwen.com/subject/zsfbdktx.html
网友评论