小编Rem*_*ein的帖子

为什么Bool"AnyObject"而不是"Any"?

我有一个简单的问题:为什么Bool符合AnyObject Apple的文档资格:

那么为什么这个陈述会通过呢?

let bool = true
let explicitBool: Bool = true

if (bool is AnyObject){
    print("I'm an object")
}

if (explicitBool is AnyObject){
    print("I'm still an object!")
}
Run Code Online (Sandbox Code Playgroud)

swift swift-playground swift2

9
推荐指数
1
解决办法
715
查看次数

标签 统计

swift ×1

swift-playground ×1

swift2 ×1