ios-swift
Domain plugin for Swift / iOS / Apple-platform corpora derived from the official Swift API Design Guidelines and the Google Swift Style Guide. Covers naming, protocol- and value-oriented design, optional handling, error propagation, memory management in closures, and structured concurrency.
Atom counts by kind
| Kind | Count |
|---|---|
| rule | 14 |
| principle | 2 |
| anti-pattern | 1 |
Tag vocabulary
Words a brief might contain that signal this domain.
Retrieval axes
Domain-specific dimensions used by Prime's retrieval scoring.
scope · 6 matches
What part of a Swift module the guidance shapes — the public surface, internal collaborators, or private implementation.
severity · 5 matches
How firm the recommendation is — a hard rule, a default that may be overridden with reason, or stylistic preference.
paradigm · 9 matches
Which Swift design dimension the atom touches — type system, naming, error handling, memory, or concurrency.
Sample atoms
Never Force Unwrap Publicly
Reaching for `!` on an `Optional` whose value originates from input — a network response, user input, an `Info.…
Clarity At Call Site
Clarity at the point of use is your most important goal. Code is read far more often than it is written. Strive to make the call site of every API a grammatical English phrase that documents its own intent.…
Swift As Progressive Disclosure
Build APIs and code in the same shape: the common case is a one-liner; the next-most-common case adds one explicit modifier; only the genuinely complex case pulls in the full machinery.…
Await Not Completion Handler
New async APIs are written as `func f(...) async throws -> T`. The call site reads as straight-line code, errors propagate through `try`, cancellation propagates through the cooperative cancellation system, and the struc…
Clarity At Call Site
Code is read far more often than it is written. Every naming and signature decision — argument labels, method vs.…
Error Throws Not Result Where Possible
Swift has two error-handling shapes: throwing functions (`func f() throws -> T`, `func f() async throws -> T`) and `Result<Success, Failure>`.…
Guard Let Early Return
When the rest of a function does not make sense without a particular optional being non-nil, write `guard let x = optionalX else { return ... }`.…
Label Args By Grammar
Argument labels exist to make the call site readable. The decision rule: read the call as English. (1) When the argument is the direct object of a verb method, omit the label: `removeAll()`, `view.add(subview)`.…
Name By Role Not Type
A name should describe what a value *is for*, not what its concrete type happens to be.…
Names Of Side Effects End Imperative
The grammar of a method name signals whether it mutates. Mutating methods use imperative verb phrases: `array.sort()`, `set.insert(x)`, `string.append("!")`.…
Omit Needless Words
Every word in a name should carry information at the call site. Words that merely repeat type information already present in the signature are noise: `removeElement(_ element: Element)` is `remove(_ element: Element)`.…
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!`.…