(... as? ...)?.method()

Swift โŸฉ Pattern Matching โŸฉ Sentence Patterns โŸฉ

  • as?: optional binding.

  • ()?.method(): optional chaining.

๐Ÿ’พ ็จ‹ๅผ๏ผš Mirror.handleChildren()

// โญ `(... as? ...)?.method()` (optional chaining)
for child in mirror.children {
    (child.value as? Resettable)?.reset()
}

Last updated