... 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?