Skill Wiki v0.1.0
rule @ios-swift/rule-optional-chaining-over-nil-check

Optional Chaining Over Nil Check

When the goal is 'do this only if the value is present, otherwise produce nothing or a default', Swift gives three short-circuiting forms that are clearer than an `if x != nil` check followed by a body that uses `x!`.…

Skill
@ios-swift
Domain
ios-swift
Version
0.1.0
Quality
4.0
Edges
2 out · 2 in
Tokens
136/298/317
$ prime install @ios-swift/rule-optional-chaining-over-nil-check

Projection

Always in _index.xml · the agent never has to ask for this.

OptionalChainingOverNilCheck [rule] v0.1.0

When the goal is 'do this only if the value is present, otherwise produce nothing or a default', Swift gives three short-circuiting forms that are clearer than an if x != nil check followed by a body that uses x!. Optional chaining (a?.b?.c()) propagates nil. Nil-coalescing (x ?? default) supplies a fallback. Pattern matching (if case let .some(value) = x) reads the cases explicitly. Each removes a force-unwrap and makes the absence-handling part of the expression.

Source

prime-system/examples/ios-swift/primes/compiled/@ios-swift/rule-optional-chaining-over-nil-check/atom.yaml

Compiled at 2026-05-10