← ClaudeAtlas

swift-languagelisted

Apply modern Swift language patterns and idioms for non-concurrency, non-SwiftUI code. Covers if/switch expressions (Swift 5.9+), typed throws (Swift 6+), result builders, property wrappers, opaque and existential types (some vs any), guard patterns, Never type, Regex builders (Swift 5.7+), Codable best practices (CodingKeys, custom decoding, nested containers), modern collection APIs (count(where:), contains(where:), replacing()), FormatStyle (.formatted() on dates, numbers, measurements), and string interpolation patterns. Use when writing core Swift code involving generics, protocols, enums, closures, or modern language features.
dpearson2699/swift-ios-skills · ★ 730 · API & Backend · score 80
Install: claude install-skill dpearson2699/swift-ios-skills
# Swift Language Patterns Core Swift language features and modern syntax patterns targeting Swift 6.3. Covers language constructs, type system features, Codable, string and collection APIs, formatting, C interop (`@c`), module disambiguation (`ModuleName::symbol`), and performance attributes (`@specialized`, `@inline(always)`). For concurrency (actors, async/await, Sendable), see the `swift-concurrency` skill. For SwiftUI views and state management, see `swiftui-patterns`. ## Contents - [If/Switch Expressions](#ifswitch-expressions) - [Typed Throws](#typed-throws) - [Result Builders](#result-builders) - [Property Wrappers](#property-wrappers) - [Opaque and Existential Types](#opaque-and-existential-types) - [Guard Patterns](#guard-patterns) - [Never Type](#never-type) - [Regex Builders](#regex-builders) - [Codable Best Practices](#codable-best-practices) - [Modern Collection APIs](#modern-collection-apis) - [FormatStyle](#formatstyle) - [String Interpolation](#string-interpolation) - [Common Mistakes](#common-mistakes) - [Review Checklist](#review-checklist) - [References](#references) ## If/Switch Expressions Swift 5.9+ allows `if` and `switch` as expressions that return values. Use them to assign, return, or initialize directly. ```swift // Assign from if expression let icon = if isComplete { "checkmark.circle.fill" } else { "circle" } // Assign from switch expression let label = switch status { case .draft: "Draft" case .published: "Published" case .archived: "Archi