getElementById
我有一个这样的清单。我可以通过
逐个调用这些项目struct List {
class Item1: Holdable, Throwable {
var property1 = "A"
var property2 = "B"
}
class Item2: Holdable {
var property2 = "A"
var property3 = "B"
}
class Item3: Throwable, Catchable {
var property4 = "A"
var property5 = "B"
}
}
但如果我想要所有可保持物品,我怎么能得到它们?
答案 0 :(得分:0)
看看这个'自我解释'示例
struct S {
class A{}
class B{}
struct C{}
}
let a = S.A.self // S.A.Type
let b = S.B() // instance of S.B class
let c = S.C() // instance of S.C struct
let s = S() // instance of struct S without any property
这根本不应该编译
let a = S.A // error!!
let b = S.B // error!!