Swift 標準ライブラリ   >   Mirror   >   Children
型エイリアス
Children
亜構造体を表すために使用される型。
宣言
議論
必要に応じて、この型のインスタンスを AnyBidirectionalCollection または AnyRandomAccessCollection に「アップグレード」すると便利です。たとえば、効率的にアクセスできる場合、mirror の最後の 20 人の子を表示するには、次のように記述します。
if let b = AnyBidirectionalCollection(someMirror.children) {
var i = xs.index(b.endIndex, offsetBy: -20,
limitedBy: b.startIndex) ?? b.startIndex
while i != xs.endIndex {
print(b[i])
b.formIndex(after: &i)
}
}