... as! ...
Swift โฉ Pattern Matching โฉ Sentence Patterns โฉ
๐พ ็จๅผ๏ผ Mirror.handleChildren()
// mirror self
let mirror = Mirror(reflecting: self)
// โฑ child.label ignored โญโโโ โญ where clause โโโโโฎ
for case let (_, value) in mirror.children where value is Resettable {
// โญ `as!` force type casting (from Any to Resettable)
// "where clause" ensures `value` IS `Resettable`!
(value as! Resettable).reset()
}
Last updated
Was this helpful?