class ca{
}
class cb:ca{
}
var library:[Any] = [
ca(),
cb(),
1,
]
for item in library{
if let intitem = item as? Int{
println(item);
}
}
println("-------分界线-------");
var items:[AnyObject]=[
ca(),]
for item in items as! [ca]{
println(item);
}
原文链接:https://www.f2er.com/swift/326908.html