{"id":"da6ee795-7134-4740-9538-c148668d6cf3","shortId":"5drTJa","kind":"skill","title":"swift-language","tagline":"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 (S","description":"# Swift Language Patterns\n\nCore Swift language features and modern syntax patterns targeting Swift 6.3. Covers language constructs, type system features, Codable,\nstring and collection APIs, formatting, C interop (`@c`), module disambiguation (`ModuleName::symbol`), and performance attributes (`@specialized`, `@inline(always)`). For concurrency (actors, async/await,\nSendable), see the `swift-concurrency` skill. For SwiftUI views and state\nmanagement, see `swiftui-patterns`.\n\n## Contents\n\n- [If/Switch Expressions](#ifswitch-expressions)\n- [Typed Throws](#typed-throws)\n- [Result Builders](#result-builders)\n- [Property Wrappers](#property-wrappers)\n- [Opaque and Existential Types](#opaque-and-existential-types)\n- [Guard Patterns](#guard-patterns)\n- [Never Type](#never-type)\n- [Regex Builders](#regex-builders)\n- [Codable Best Practices](#codable-best-practices)\n- [Modern Collection APIs](#modern-collection-apis)\n- [FormatStyle](#formatstyle)\n- [String Interpolation](#string-interpolation)\n- [Common Mistakes](#common-mistakes)\n- [Review Checklist](#review-checklist)\n- [References](#references)\n\n## If/Switch Expressions\n\nSwift 5.9+ allows `if` and `switch` as expressions that return values. Use them\nto assign, return, or initialize directly.\n\n```swift\n// Assign from if expression\nlet icon = if isComplete { \"checkmark.circle.fill\" } else { \"circle\" }\n\n// Assign from switch expression\nlet label = switch status {\ncase .draft: \"Draft\"\ncase .published: \"Published\"\ncase .archived: \"Archived\"\n}\n\n// Works in return position\nfunc color(for priority: Priority) -> Color {\n    switch priority {\n    case .high: .red\n    case .medium: .orange\n    case .low: .green\n    }\n}\n```\n\n**Rules:**\n- Every branch must produce a value of the same type.\n- Multi-statement branches are not allowed -- each branch is a single expression.\n- Wrap in parentheses when used as a function argument to avoid ambiguity.\n\n## Typed Throws\n\nSwift 6+ allows specifying the error type a function throws.\n\n```swift\nenum ValidationError: Error {\n    case tooShort, invalidCharacters, alreadyTaken\n}\n\nfunc validate(username: String) throws(ValidationError) -> String {\n    guard username.count >= 3 else { throw .tooShort }\n    guard username.allSatisfy(\\.isLetterOrDigit) else { throw .invalidCharacters }\n    return username.lowercased()\n}\n\n// Caller gets typed error -- no cast needed\ndo {\n    let name = try validate(username: input)\n} catch {\n    // error is ValidationError, not any Error\n    switch error {\n    case .tooShort: print(\"Too short\")\n    case .invalidCharacters: print(\"Invalid characters\")\n    case .alreadyTaken: print(\"Taken\")\n    }\n}\n```\n\n**Rules:**\n- Use `throws(SomeError)` only when callers benefit from exhaustive error\n  handling. For mixed error sources, use untyped `throws`.\n- `throws(Never)` marks a function that syntactically throws but never actually\n  does -- useful in generic contexts.\n- Typed throws propagate: a function calling `throws(A)` and `throws(B)` must\n  itself throw a type that covers both (or use untyped `throws`).\n\n## Result Builders\n\n`@resultBuilder` enables DSL-style syntax. SwiftUI's `@ViewBuilder` is the most\ncommon example, but you can create custom builders for any domain.\n\n```swift\n@resultBuilder\nstruct ArrayBuilder<Element> {\n    static func buildBlock(_ components: [Element]...) -> [Element] {\n        components.flatMap { $0 }\n    }\n    static func buildExpression(_ expression: Element) -> [Element] { [expression] }\n    static func buildOptional(_ component: [Element]?) -> [Element] { component ?? [] }\n    static func buildEither(first component: [Element]) -> [Element] { component }\n    static func buildEither(second component: [Element]) -> [Element] { component }\n    static func buildArray(_ components: [[Element]]) -> [Element] { components.flatMap { $0 } }\n}\n\nfunc makeItems(@ArrayBuilder<String> content: () -> [String]) -> [String] { content() }\n\nlet items = makeItems {\n    \"Always included\"\n    if showExtra { \"Conditional\" }\n    for name in names { name.uppercased() }\n}\n```\n\n**Builder methods:** `buildBlock` (combine statements), `buildExpression` (single value), `buildOptional` (`if` without `else`), `buildEither` (`if/else`), `buildArray` (`for..in`), `buildFinalResult` (optional post-processing).\n\n## Property Wrappers\n\nCustom `@propertyWrapper` types encapsulate storage and access patterns.\n\n```swift\n@propertyWrapper\nstruct Clamped<Value: Comparable> {\n    private var value: Value\n    let range: ClosedRange<Value>\n\n    var wrappedValue: Value {\n        get { value }\n        set { value = min(max(newValue, range.lowerBound), range.upperBound) }\n    }\n\n    var projectedValue: ClosedRange<Value> { range }\n\n    init(wrappedValue: Value, _ range: ClosedRange<Value>) {\n        self.range = range\n        self.value = min(max(wrappedValue, range.lowerBound), range.upperBound)\n    }\n}\n\n// Usage\nstruct Volume {\n    @Clamped(0...100) var level: Int = 50\n}\n\nvar v = Volume()\nv.level = 150   // clamped to 100\nprint(v.$level) // projected value: 0...100\n```\n\n**Design rules:**\n- `wrappedValue` is the primary getter/setter.\n- `projectedValue` (accessed via `$property`) provides metadata or bindings.\n- Property wrappers can be composed: `@A @B var x` applies outer wrapper first.\n- Do not use property wrappers when a simple computed property suffices.\n\n## Opaque and Existential Types\n\n### `some Protocol` (Opaque Type)\n\nThe caller does not know the concrete type, but the compiler does. The\nunderlying type is fixed for a given scope.\n\n```swift\nfunc makeCollection() -> some Collection<Int> {\n    [1, 2, 3]  // Always returns Array<Int> -- compiler knows the concrete type\n}\n```\n\nUse `some` for:\n- Return types when you want to hide implementation but preserve type identity.\n- Parameter types (Swift 5.9+): `func process(_ items: some Collection<Int>)` --\n  equivalent to a generic `<C: Collection<Int>>`.\n\n### `any Protocol` (Existential Type)\n\nAn existential box that can hold any conforming type at runtime. Has overhead\nfrom dynamic dispatch and heap allocation.\n\n```swift\nfunc process(items: [any StringProtocol]) {\n    for item in items {\n        print(item.uppercased())\n    }\n}\n```\n\n### When to choose\n\n| Use `some` | Use `any` |\n|---|---|\n| Return type hiding concrete type | Heterogeneous collections |\n| Function parameters (replaces simple generics) | Dynamic type erasure needed |\n| Better performance (static dispatch) | Protocol has `Self` or associated type requirements you need to erase |\n\n**Rule of thumb:** Default to `some`. Use `any` only when you need a\nheterogeneous collection or runtime type flexibility.\n\n## Guard Patterns\n\n`guard` enforces preconditions and enables early exit. It keeps the happy path\nleft-aligned and reduces nesting.\n\n```swift\nfunc processOrder(_ order: Order?) throws -> Receipt {\n    // Unwrap optionals\n    guard let order else { throw OrderError.missing }\n\n    // Validate conditions\n    guard order.items.isEmpty == false else { throw OrderError.empty }\n    guard order.total > 0 else { throw OrderError.invalidTotal }\n\n    // Boolean checks\n    guard order.isPaid else { throw OrderError.unpaid }\n\n    // Pattern matching\n    guard case .confirmed(let date) = order.status else {\n        throw OrderError.notConfirmed\n    }\n\n    return Receipt(order: order, confirmedAt: date)\n}\n```\n\n**Best practices:**\n- Use `guard` for preconditions, `if` for branching logic.\n- Combine related guards: `guard let a, let b else { return }`.\n- The `else` block must exit scope: `return`, `throw`, `continue`, `break`, or\n  `fatalError()`.\n- Use shorthand unwrap: `guard let value else { ... }` (Swift 5.7+).\n\n## Never Type\n\n`Never` indicates a function that never returns. It conforms to all protocols\nsince Swift 5.5+ (bottom type).\n\n```swift\n// Function that terminates the program\nfunc crashWithDiagnostics(_ message: String) -> Never {\n    let diagnostics = gatherDiagnostics()\n    logger.critical(\"\\(message): \\(diagnostics)\")\n    fatalError(message)\n}\n\n// Useful in generic contexts\nenum Result<Success, Failure: Error> {\n    case success(Success)\n    case failure(Failure)\n}\n// Result<String, Never> -- a result that can never fail\n// Result<Never, Error>  -- a result that can never succeed\n\n// Exhaustive switch: no default needed since Never has no cases\nfunc handle(_ result: Result<String, Never>) {\n    switch result {\n    case .success(let value): print(value)\n    // No .failure case needed -- compiler knows it's impossible\n    }\n}\n```\n\n## Regex Builders\n\nSwift 5.7+ Regex builder DSL provides compile-time checked, readable patterns.\n\n```swift\nimport RegexBuilder\n\n// Parse \"2024-03-15\" into components\nlet dateRegex = Regex {\n    Capture { /\\d{4}/ }; \"-\"; Capture { /\\d{2}/ }; \"-\"; Capture { /\\d{2}/ }\n}\n\nif let match = \"2024-03-15\".firstMatch(of: dateRegex) {\n    let (_, year, month, day) = match.output\n}\n\n// TryCapture with transform\nlet priceRegex = Regex {\n    \"$\"\n    TryCapture { OneOrMore(.digit); \".\"; Repeat(.digit, count: 2) }\n        transform: { Decimal(string: String($0)) }\n}\n```\n\n**When to use builder vs. literal:**\n- Builder: complex patterns, reusable components, strong typing on captures.\n- Literal (`/pattern/`): simple patterns, familiarity with regex syntax.\n- Both can be mixed: embed `/.../` literals inside builder blocks.\n\n## Codable Best Practices\n\n### Custom CodingKeys\n\nRename keys without writing a custom decoder:\n\n```swift\nstruct User: Codable {\n    let id: Int\n    let displayName: String\n    let avatarURL: URL\n\n    enum CodingKeys: String, CodingKey {\n        case id\n        case displayName = \"display_name\"\n        case avatarURL = \"avatar_url\"\n    }\n}\n```\n\n### Custom Decoding\n\nHandle mismatched types, defaults, and transformations:\n\n```swift\nstruct Item: Decodable {\n    let name: String\n    let quantity: Int\n    let isActive: Bool\n\n    init(from decoder: Decoder) throws {\n        let container = try decoder.container(keyedBy: CodingKeys.self)\n        name = try container.decode(String.self, forKey: .name)\n        quantity = try container.decodeIfPresent(Int.self, forKey: .quantity) ?? 0\n        if let boolValue = try? container.decode(Bool.self, forKey: .isActive) {\n            isActive = boolValue\n        } else {\n            isActive = (try container.decode(String.self, forKey: .isActive)).lowercased() == \"true\"\n        }\n    }\n    enum CodingKeys: String, CodingKey { case name, quantity; case isActive = \"is_active\" }\n}\n```\n\n### Nested Containers\n\nFlatten nested JSON into a flat Swift struct:\n\n```swift\n// JSON: { \"id\": 1, \"metadata\": { \"created_at\": \"...\", \"tags\": [...] } }\nstruct Record: Decodable {\n    let id: Int\n    let createdAt: String\n    let tags: [String]\n\n    enum CodingKeys: String, CodingKey {\n        case id, metadata\n    }\n\n    enum MetadataKeys: String, CodingKey {\n        case createdAt = \"created_at\"\n        case tags\n    }\n\n    init(from decoder: Decoder) throws {\n        let container = try decoder.container(keyedBy: CodingKeys.self)\n        id = try container.decode(Int.self, forKey: .id)\n        let metadata = try container.nestedContainer(\n            keyedBy: MetadataKeys.self, forKey: .metadata)\n        createdAt = try metadata.decode(String.self, forKey: .createdAt)\n        tags = try metadata.decode([String].self, forKey: .tags)\n    }\n}\n```\n\nSee [references/swift-patterns-extended.md](references/swift-patterns-extended.md) for additional Codable patterns\n(enums with associated values, date strategies, unkeyed containers).\n\n## Modern Collection APIs\n\nPrefer these modern APIs over manual loops:\n\n```swift\nlet numbers = [1, 2, 3, 4, 5, 6, 7, 8]\n\n// count(where:) -- Swift 5.0+, use instead of .filter { }.count\nlet evenCount = numbers.count(where: { $0.isMultiple(of: 2) })\n\n// contains(where:) -- short-circuits on first match\nlet hasNegative = numbers.contains(where: { $0 < 0 })\n\n// first(where:) / last(where:)\nlet firstEven = numbers.first(where: { $0.isMultiple(of: 2) })\n\n// String replacing() -- Swift 5.7+, returns new string\nlet cleaned = rawText.replacing(/\\s+/, with: \" \")\nlet snakeCase = name.replacing(\"_\", with: \" \")\n\n// compactMap -- unwrap optionals from a transform\nlet ids = strings.compactMap { Int($0) }\n\n// flatMap -- flatten nested collections\nlet allTags = articles.flatMap(\\.tags)\n\n// Dictionary(grouping:by:)\nlet byCategory = Dictionary(grouping: items, by: \\.category)\n\n// reduce(into:) -- efficient accumulation\nlet freq = words.reduce(into: [:]) { counts, word in\n    counts[word, default: 0] += 1\n}\n```\n\n## FormatStyle\n\nUse `.formatted()` instead of `DateFormatter`/`NumberFormatter`. It is\ntype-safe, localized, and concise.\n\n```swift\n// Dates\nlet now = Date.now\nnow.formatted()                                       // \"3/15/2024, 2:30 PM\"\nnow.formatted(date: .abbreviated, time: .shortened)   // \"Mar 15, 2024, 2:30 PM\"\nnow.formatted(.dateTime.year().month().day())          // \"Mar 15, 2024\"\nnow.formatted(.relative(presentation: .named))        // \"yesterday\"\n\n// Numbers\nlet price = 42.5\nprice.formatted(.currency(code: \"USD\"))               // \"$42.50\"\nprice.formatted(.percent)                             // \"4,250%\"\n(1_000_000).formatted(.number.notation(.compactName)) // \"1M\"\n\n// Measurements\nlet distance = Measurement(value: 5, unit: UnitLength.kilometers)\ndistance.formatted(.measurement(width: .abbreviated)) // \"5 km\"\n\n// Duration (Swift 5.7+)\nlet duration = Duration.seconds(3661)\nduration.formatted(.time(pattern: .hourMinuteSecond)) // \"1:01:01\"\n\n// Byte counts\nInt64(1_500_000).formatted(.byteCount(style: .file)) // \"1.5 MB\"\n\n// Lists\n[\"Alice\", \"Bob\", \"Carol\"].formatted(.list(type: .and)) // \"Alice, Bob, and Carol\"\n```\n\n**Parsing:** `FormatStyle` also supports parsing:\n```swift\nlet value = try Decimal(\"$42.50\", format: .currency(code: \"USD\"))\nlet date = try Date(\"Mar 15, 2024\", strategy: .dateTime.month().day().year())\n```\n\n## String Interpolation\n\nExtend `DefaultStringInterpolation` for domain-specific formatting. Use `\"\"\"` for multi-line strings (indentation is relative to the closing `\"\"\"`). See [references/swift-patterns-extended.md](references/swift-patterns-extended.md) for custom interpolation examples.\n\n## Common Mistakes\n\n1. **Using `any` when `some` works.** Default to `some` for return types and\n   parameters. `any` has runtime overhead and loses type information.\n2. **Manual loops instead of collection APIs.** Use `count(where:)`,\n   `contains(where:)`, `compactMap`, `flatMap` instead of manual iteration.\n3. **`DateFormatter` instead of FormatStyle.** `.formatted()` is simpler,\n   type-safe, and handles localization automatically.\n4. **Force-unwrapping Codable decodes.** Use `decodeIfPresent` with defaults\n   for optional or missing keys.\n5. **Nested if-let chains.** Use `guard let` for preconditions to keep the\n   happy path at the top level.\n6. **String regex for simple operations.** Use `.replacing()` and\n   `.contains()` before reaching for Regex.\n7. **Ignoring typed throws.** When a function has a single, clear error type,\n   typed throws give callers exhaustive switch without casting.\n8. **Overusing property wrappers.** A computed property is simpler when there\n   is no reuse or projected value needed.\n9. **Building collections with `var` + `append` in a loop.** Prefer `map`,\n   `filter`, `compactMap`, or `reduce(into:)`.\n10. **Not using if/switch expressions.** When assigning from a condition, use\n    an expression instead of declaring `var` and mutating it.\n\n## Review Checklist\n\n- [ ] `some` used over `any` where possible\n- [ ] `guard` for preconditions; collection APIs instead of manual loops\n- [ ] `.formatted()` used instead of `DateFormatter`/`NumberFormatter`\n- [ ] Codable types use `CodingKeys` for API mapping; `decodeIfPresent` with defaults for optional fields\n- [ ] if/switch expressions for conditional assignment; property wrappers have clear reuse justification\n- [ ] Regex builder used for complex patterns (literal OK for simple ones)\n- [ ] String interpolation is clean; no unnecessary `String(describing:)`\n- [ ] Typed throws used when callers benefit from exhaustive error handling\n- [ ] `Never` used appropriately in generic contexts\n\n## References\n\n- Extended patterns and Codable examples: [references/swift-patterns-extended.md](references/swift-patterns-extended.md)\n- Attributes and C interop (`@c`, `@specialized`, `@inline(always)`, `@export`, `ModuleName::symbol`): [references/swift-attributes-interop.md](references/swift-attributes-interop.md)","tags":["swift","language","ios","skills","dpearson2699","accessibility","agent-skills","ai-coding","apple","claude-code","codex-skills","cursor-skills"],"capabilities":["skill","source-dpearson2699","skill-swift-language","topic-accessibility","topic-agent-skills","topic-ai-coding","topic-apple","topic-claude-code","topic-codex-skills","topic-cursor-skills","topic-ios","topic-ios-development","topic-liquid-glass","topic-localization","topic-mapkit"],"categories":["swift-ios-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/dpearson2699/swift-ios-skills/swift-language","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add dpearson2699/swift-ios-skills","source_repo":"https://github.com/dpearson2699/swift-ios-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 599 github stars · SKILL.md body (16,424 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:53:45.080Z","embedding":null,"createdAt":"2026-04-18T20:34:04.928Z","updatedAt":"2026-05-18T18:53:45.080Z","lastSeenAt":"2026-05-18T18:53:45.080Z","tsv":"'-03':1062,1082 '-15':1063,1083 '/pattern':1126 '0':463,501,598,617,870,1109,1225,1405,1406,1444,1477 '0.ismultiple':1390,1415 '000':1541,1542,1580 '01':1573,1574 '1':692,1269,1369,1478,1540,1572,1578,1655 '1.5':1585 '10':1814 '100':599,611,618 '15':1510,1520,1619 '150':608 '1m':1546 '2':693,1074,1077,1104,1370,1392,1417,1501,1512,1677 '2024':1061,1081,1511,1521,1620 '250':1539 '3':320,694,1371,1695 '3/15/2024':1500 '30':1502,1513 '3661':1567 '4':1071,1372,1538,1710 '42.5':1530 '42.50':1535,1609 '5':1373,1552,1559,1725 '5.0':1380 '5.5':955 '5.7':938,1046,1421,1563 '5.9':23,187,721 '50':603 '500':1579 '6':27,294,1374,1745 '6.3':59 '7':1375,1759 '8':1376,1780 '9':1798 'abbrevi':1506,1558 'access':552,627 'accumul':1466 'activ':1255 'actor':87 'actual':398 'addit':1345 'alic':1588,1595 'align':841 'alloc':755 'allow':188,272,295 'alltag':1450 'alreadytaken':310,366 'also':1601 'alway':84,512,695,1931 'ambigu':290 'api':70,160,164,1358,1362,1683,1846,1862 'append':1803 'appli':4,643 'appropri':1912 'archiv':232,233 'argument':287 'array':697 'arraybuild':455,504 'articles.flatmap':1451 'assign':200,206,217,1820,1874 'associ':799,1350 'async/await':88 'attribut':81,1924 'automat':1709 'avatar':1179 'avatarurl':1165,1178 'avoid':289 'b':414,640,915 'benefit':376,1905 'best':152,156,898,1143 'better':791 'bind':633 'block':920,1141 'bob':1589,1596 'bool':1201 'bool.self':1231 'boolean':874 'boolvalu':1228,1235 'bottom':956 'box':739 'branch':257,269,274,906 'break':927 'build':1799 'buildarray':496,536 'buildblock':458,524 'buildeith':480,488,534 'builder':29,44,118,121,147,150,428,448,522,1044,1048,1113,1116,1140,1882 'buildexpress':466,527 'buildfinalresult':539 'buildopt':473,530 'bycategori':1457 'byte':1575 'bytecount':1582 'c':72,74,731,1926,1928 'call':409 'caller':332,375,667,1775,1904 'captur':1069,1072,1075,1124 'carol':1590,1598 'case':225,228,231,246,249,252,307,355,360,365,884,986,989,1019,1028,1036,1171,1173,1177,1249,1252,1290,1297,1301 'cast':337,1779 'catch':346 'categori':1462 'chain':1730 'charact':364 'check':875,1054 'checklist':178,181,1835 'checkmark.circle.fill':214 'choos':770 'circl':216 'circuit':1397 'clamp':557,597,609 'clean':1426,1895 'clear':1769,1878 'close':1645 'closedrang':564,579,585 'codabl':66,151,155,1142,1157,1346,1714,1857,1920 'codable-best-practic':154 'code':18,1533,1612 'codingkey':1146,1168,1170,1246,1248,1287,1289,1296,1860 'codingkeys.self':1212,1313 'collect':69,159,163,691,726,732,781,820,1357,1448,1682,1800,1845 'color':239,243 'combin':525,908 'common':172,175,441,1653 'common-mistak':174 'compactmap':1434,1689,1810 'compactnam':1545 'compil':676,698,1038,1052 'compile-tim':1051 'complex':1117,1885 'compon':459,474,477,482,485,490,493,497,1065,1120 'components.flatmap':462,500 'compos':638 'comput':655,1785 'concis':1493 'concret':672,701,778 'concurr':14,86,94 'condit':516,861,1823,1873 'confirm':885 'confirmedat':896 'conform':744,949 'construct':62 'contain':1208,1257,1309,1355,1393,1687,1754 'container.decode':1215,1230,1239,1316 'container.decodeifpresent':1221 'container.nestedcontainer':1323 'content':106,505,508 'context':403,980,1915 'continu':926 'core':49 'count':1103,1377,1385,1471,1474,1576,1685 'cover':19,60,421 'crashwithdiagnost':965 'creat':446,1271,1299 'createdat':1281,1298,1328,1333 'currenc':1532,1611 'custom':447,546,1145,1152,1181,1650 'd':1070,1073,1076 'date':887,897,1352,1495,1505,1615,1617 'date.now':1498 'dateformatt':1484,1696,1855 'dateregex':1067,1086 'datetime.month':1622 'datetime.year':1516 'day':1090,1518,1623 'decim':1106,1608 'declar':1829 'decod':1153,1182,1192,1204,1205,1276,1305,1306,1715 'decodeifpres':1717,1864 'decoder.container':1210,1311 'default':809,1013,1186,1476,1661,1719,1866 'defaultstringinterpol':1628 'describ':1899 'design':619 'diagnost':970,974 'dictionari':1453,1458 'digit':1100,1102 'direct':204 'disambigu':76 'dispatch':752,794 'display':1175 'displaynam':1162,1174 'distanc':1549 'distance.formatted':1555 'domain':451,1631 'domain-specif':1630 'draft':226,227 'dsl':432,1049 'dsl-style':431 'durat':1561,1565 'duration.formatted':1568 'duration.seconds':1566 'dynam':751,787 'earli':832 'effici':1465 'element':460,461,468,469,475,476,483,484,491,492,498,499 'els':215,321,327,533,857,865,871,878,889,916,919,936,1236 'emb':1137 'enabl':430,831 'encapsul':549 'enforc':828 'enum':304,981,1167,1245,1286,1293,1348 'equival':727 'eras':805 'erasur':789 'error':298,306,335,347,352,354,379,383,985,1003,1770,1908 'evencount':1387 'everi':256 'exampl':442,1652,1921 'exhaust':378,1010,1776,1907 'existenti':34,129,134,660,735,738 'exit':833,922 'export':1932 'express':21,108,111,185,193,209,220,278,467,470,1818,1826,1871 'extend':1627,1917 'fail':1000 'failur':984,990,991,1035 'fals':864 'familiar':1129 'fatalerror':929,975 'featur':52,65 'field':1869 'file':1584 'filter':1384,1809 'first':481,646,1399,1407 'firsteven':1412 'firstmatch':1084 'fix':682 'flat':1263 'flatmap':1445,1690 'flatten':1258,1446 'flexibl':824 'forc':1712 'force-unwrap':1711 'forkey':1217,1223,1232,1241,1318,1326,1332,1339 'format':71,1481,1543,1581,1591,1610,1633,1700,1851 'formatstyl':165,166,1479,1600,1699 'freq':1468 'func':238,311,457,465,472,479,487,495,502,688,722,757,846,964,1020 'function':286,301,392,408,782,944,959,1765 'gatherdiagnost':971 'generic':402,730,786,979,1914 'get':333,568 'getter/setter':625 'give':1774 'given':685 'green':254 'group':1454,1459 'guard':39,136,139,318,324,825,827,854,862,868,876,883,901,910,911,933,1732,1842 'guard-pattern':138 'handl':380,1021,1183,1707,1909 'happi':837,1739 'hasneg':1402 'heap':754 'heterogen':780,819 'hide':712,777 'high':247 'hold':742 'hourminutesecond':1571 'icon':211 'id':1159,1172,1268,1278,1291,1314,1319,1441 'ident':717 'idiom':10 'if-let':1727 'if/else':535 'if/switch':20,107,184,1817,1870 'ifswitch':110 'ifswitch-express':109 'ignor':1760 'implement':713 'import':1058 'imposs':1042 'includ':513 'indent':1640 'indic':942 'inform':1676 'init':581,1202,1303 'initi':203 'inlin':83,1930 'input':345 'insid':1139 'instead':1382,1482,1680,1691,1697,1827,1847,1853 'int':602,1160,1198,1279,1443 'int.self':1222,1317 'int64':1577 'interop':73,1927 'interpol':168,171,1626,1651,1893 'invalid':363 'invalidcharact':309,329,361 'isact':1200,1233,1234,1237,1242,1253 'iscomplet':213 'isletterordigit':326 'item':510,724,759,763,765,1191,1460 'item.uppercased':767 'iter':1694 'json':1260,1267 'justif':1880 'keep':835,1737 'key':1148,1724 'keyedbi':1211,1312,1324 'km':1560 'know':670,699,1039 'label':222 'languag':3,7,47,51,61 'last':1409 'left':840 'left-align':839 'let':210,221,340,509,562,855,886,912,914,934,969,1030,1066,1079,1087,1095,1158,1161,1164,1193,1196,1199,1207,1227,1277,1280,1283,1308,1320,1367,1386,1401,1411,1425,1430,1440,1449,1456,1467,1496,1528,1548,1564,1605,1614,1729,1733 'level':601,614,1744 'line':1638 'list':1587,1592 'liter':1115,1125,1138,1887 'local':1491,1708 'logger.critical':972 'logic':907 'loop':1365,1679,1806,1850 'lose':1674 'low':253 'lowercas':1243 'makecollect':689 'makeitem':503,511 'manag':101 'manual':1364,1678,1693,1849 'map':1808,1863 'mar':1509,1519,1618 'mark':390 'match':882,1080,1400 'match.output':1091 'max':573,590 'mb':1586 'measur':1547,1550,1556 'medium':250 'messag':966,973,976 'metadata':631,1270,1292,1321,1327 'metadata.decode':1330,1336 'metadatakey':1294 'metadatakeys.self':1325 'method':523 'min':572,589 'mismatch':1184 'miss':1723 'mistak':173,176,1654 'mix':382,1136 'modern':5,54,158,162,1356,1361 'modern-collection-api':161 'modul':75 'modulenam':77,1933 'month':1089,1517 'multi':267,1637 'multi-lin':1636 'multi-stat':266 'must':258,415,921 'mutat':1832 'name':341,518,520,1176,1194,1213,1218,1250,1525 'name.replacing':1432 'name.uppercased':521 'need':338,790,803,817,1014,1037,1797 'nest':844,1256,1259,1447,1726 'never':41,141,144,389,397,939,941,946,968,994,999,1002,1008,1016,1025,1910 'never-typ':143 'new':1423 'newvalu':574 'non':13,16 'non-concurr':12 'non-swiftui':15 'now.formatted':1499,1504,1515,1522 'number':1368,1527 'number.notation':1544 'numberformatt':1485,1856 'numbers.contains':1403 'numbers.count':1388 'numbers.first':1413 'ok':1888 'one':1891 'oneormor':1099 'opaqu':32,127,132,658,664 'opaque-and-existential-typ':131 'oper':1750 'option':540,853,1436,1721,1868 'orang':251 'order':848,849,856,894,895 'order.ispaid':877 'order.items.isempty':863 'order.status':888 'order.total':869 'ordererror.empty':867 'ordererror.invalidtotal':873 'ordererror.missing':859 'ordererror.notconfirmed':891 'ordererror.unpaid':880 'outer':644 'overhead':749,1672 'overus':1781 'paramet':718,783,1668 'parenthes':281 'pars':1060,1599,1603 'path':838,1740 'pattern':8,40,48,56,105,137,140,553,826,881,1056,1118,1128,1347,1570,1886,1918 'percent':1537 'perform':80,792 'pm':1503,1514 'posit':237 'possibl':1841 'post':542 'post-process':541 'practic':153,157,899,1144 'precondit':829,903,1735,1844 'prefer':1359,1807 'present':1524 'preserv':715 'price':1529 'price.formatted':1531,1536 'priceregex':1096 'primari':624 'print':357,362,367,612,766,1032 'prioriti':241,242,245 'privat':558 'process':543,723,758 'processord':847 'produc':259 'program':963 'project':615,1795 'projectedvalu':578,626 'propag':406 'properti':30,122,125,544,629,634,650,656,1782,1786,1875 'property-wrapp':124 'propertywrapp':547,555 'protocol':663,734,795,952 'provid':630,1050 'publish':229,230 'quantiti':1197,1219,1224,1251 'rang':563,580,584,587 'range.lowerbound':575,592 'range.upperbound':576,593 'rawtext.replacing':1427 'reach':1756 'readabl':1055 'receipt':851,893 'record':1275 'red':248 'reduc':843,1463,1812 'refer':182,183,1916 'references/swift-attributes-interop.md':1935,1936 'references/swift-patterns-extended.md':1342,1343,1647,1648,1922,1923 'regex':43,146,149,1043,1047,1068,1097,1131,1747,1758,1881 'regex-build':148 'regexbuild':1059 'relat':909,1523,1642 'renam':1147 'repeat':1101 'replac':784,1419,1752 'requir':801 'result':28,117,120,427,982,992,996,1001,1005,1022,1023,1027 'result-build':119 'resultbuild':429,453 'return':195,201,236,330,696,706,775,892,917,924,947,1422,1665 'reus':1793,1879 'reusabl':1119 'review':177,180,1834 'review-checklist':179 'rule':255,369,620,806 'runtim':747,822,1671 'safe':1490,1705 'scope':686,923 'second':489 'see':90,102,1341,1646 'self':797,1338 'self.range':586 'self.value':588 'sendabl':89 'set':570 'short':359,1396 'short-circuit':1395 'shorten':1508 'shorthand':931 'showextra':515 'simpl':654,785,1127,1749,1890 'simpler':1702,1788 'sinc':953,1015 'singl':277,528,1768 'skill':95 'skill-swift-language' 'snakecas':1431 'someerror':372 'sourc':384 'source-dpearson2699' 'special':82,1929 'specif':1632 'specifi':296 'state':100 'statement':268,526 'static':456,464,471,478,486,494,793 'status':224 'storag':550 'strategi':1353,1621 'string':67,167,170,314,317,506,507,967,993,1024,1107,1108,1163,1169,1195,1247,1282,1285,1288,1295,1337,1418,1424,1625,1639,1746,1892,1898 'string-interpol':169 'string.self':1216,1240,1331 'stringprotocol':761 'strings.compactmap':1442 'strong':1121 'struct':454,556,595,1155,1190,1265,1274 'style':433,1583 'succeed':1009 'success':983,987,988,1029 'suffic':657 'support':1602 'swift':2,6,22,26,46,50,58,93,186,205,293,303,452,554,687,720,756,845,937,954,958,1045,1057,1154,1189,1264,1266,1366,1379,1420,1494,1562,1604 'swift-concurr':92 'swift-languag':1 'swiftui':17,97,104,435 'swiftui-pattern':103 'switch':191,219,223,244,353,1011,1026,1777 'symbol':78,1934 'syntact':394 'syntax':55,434,1132 'system':64 'tag':1273,1284,1302,1334,1340,1452 'taken':368 'target':57 'termin':961 'throw':25,113,116,292,302,315,322,328,371,387,388,395,405,410,413,417,426,850,858,866,872,879,890,925,1206,1307,1762,1773,1901 'thumb':808 'time':1053,1507,1569 'tooshort':308,323,356 'top':1743 'topic-accessibility' 'topic-agent-skills' 'topic-ai-coding' 'topic-apple' 'topic-claude-code' 'topic-codex-skills' 'topic-cursor-skills' 'topic-ios' 'topic-ios-development' 'topic-liquid-glass' 'topic-localization' 'topic-mapkit' 'transform':1094,1105,1188,1439 'tri':342,1209,1214,1220,1229,1238,1310,1315,1322,1329,1335,1607,1616 'true':1244 'trycaptur':1092,1098 'type':24,35,42,63,112,115,130,135,142,145,265,291,299,334,404,419,548,661,665,673,680,702,707,716,719,736,745,776,779,788,800,823,940,957,1122,1185,1489,1593,1666,1675,1704,1761,1771,1772,1858,1900 'type-saf':1488,1703 'typed-throw':114 'under':679 'unit':1553 'unitlength.kilometers':1554 'unkey':1354 'unnecessari':1897 'untyp':386,425 'unwrap':852,932,1435,1713 'url':1166,1180 'usag':594 'usd':1534,1613 'use':197,283,370,385,400,424,649,703,771,773,812,900,930,977,1112,1381,1480,1634,1656,1684,1716,1731,1751,1816,1824,1837,1852,1859,1883,1902,1911 'user':1156 'usernam':313,344 'username.allsatisfy':325 'username.count':319 'username.lowercased':331 'v':605,613 'v.level':607 'valid':312,343,860 'validationerror':305,316,349 'valu':196,261,529,560,561,567,569,571,583,616,935,1031,1033,1351,1551,1606,1796 'var':559,565,577,600,604,641,1802,1830 'via':628 'view':98 'viewbuild':437 'volum':596,606 'vs':37,1114 'want':710 'width':1557 'without':532,1149,1778 'word':1472,1475 'words.reduce':1469 'work':234,1660 'wrap':279 'wrappedvalu':566,582,591,621 'wrapper':31,123,126,545,635,645,651,1783,1876 'write':1150 'x':642 'year':1088,1624 'yesterday':1526","prices":[{"id":"72433a34-ad2a-452e-a639-9d33fc86943a","listingId":"da6ee795-7134-4740-9538-c148668d6cf3","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"dpearson2699","category":"swift-ios-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T20:34:04.928Z"}],"sources":[{"listingId":"da6ee795-7134-4740-9538-c148668d6cf3","source":"github","sourceId":"dpearson2699/swift-ios-skills/swift-language","sourceUrl":"https://github.com/dpearson2699/swift-ios-skills/tree/main/skills/swift-language","isPrimary":false,"firstSeenAt":"2026-04-18T22:01:21.316Z","lastSeenAt":"2026-05-18T18:53:45.080Z"},{"listingId":"da6ee795-7134-4740-9538-c148668d6cf3","source":"skills_sh","sourceId":"dpearson2699/swift-ios-skills/swift-language","sourceUrl":"https://skills.sh/dpearson2699/swift-ios-skills/swift-language","isPrimary":true,"firstSeenAt":"2026-04-18T20:34:04.928Z","lastSeenAt":"2026-05-07T22:40:33.314Z"}],"details":{"listingId":"da6ee795-7134-4740-9538-c148668d6cf3","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"dpearson2699","slug":"swift-language","github":{"repo":"dpearson2699/swift-ios-skills","stars":599,"topics":["accessibility","agent-skills","ai-coding","apple","claude-code","codex-skills","cursor-skills","ios","ios-development","liquid-glass","localization","mapkit","networking","storekit","swift","swift-concurrency","swiftdata","swiftui","widgetkit","xcode"],"license":"other","html_url":"https://github.com/dpearson2699/swift-ios-skills","pushed_at":"2026-04-26T21:04:17Z","description":"Agent Skills for iOS 26+, Swift 6.3, SwiftUI, and modern Apple frameworks","skill_md_sha":"3210d53107b3f8b0c31674c4ab2cb31507045580","skill_md_path":"skills/swift-language/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/dpearson2699/swift-ios-skills/tree/main/skills/swift-language"},"layout":"multi","source":"github","category":"swift-ios-skills","frontmatter":{"name":"swift-language","description":"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."},"skills_sh_url":"https://skills.sh/dpearson2699/swift-ios-skills/swift-language"},"updatedAt":"2026-05-18T18:53:45.080Z"}}