# marksands/BetterCodable

Better Codable through Property Wrappers

Repository: https://github.com/marksands/BetterCodable
Canonical: https://ross.abutalabs.com/products/bettercodable
Homepage: http://marksands.github.io/2019/10/21/better-codable-through-property-wrappers.html
Language: Swift
License: MIT
License Family: permissive
Topics: property-wrappers, codable, swift5-1, swift-package-manager
Last push: 2023-11-23T14:20:03+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 2510, "days_push": 1014, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1804, forks 82 (observed 2026-08-28T04:05:38.323629+00:00)

## What it is
A Swift library providing property wrappers like @LossyArray, @LossyDictionary, and @DefaultCodable that simplify Codable JSON decoding. It eliminates boilerplate custom Decodable initializers by handling nulls, invalid elements, and default values declaratively.

## Use cases
- decode json arrays filtering out null or invalid elements
- provide default values for missing json fields in swift structs
- avoid writing custom init(from decoder:) boilerplate
- tolerate messy api responses with null values
- decode dictionaries while dropping invalid key-value pairs

## When to choose
- your swift app consumes json apis with inconsistent or null data
- you want declarative, wrapper-based Codable customization instead of manual initializers
- you use Swift 5.1+ with Swift Package Manager

## When to avoid
- you need strict decoding that fails on any malformed data
- your project targets Swift versions before 5.1
- you need wrappers for formats beyond what the library provides and don't want to write custom strategies

## Facets
- artifact type: library
- maturity: maintenance
- function: serialization, parser
- domain: developer-tools, apis, mobile-development
- platform: -
- tags: codable, property-wrappers, json-decoding, swift-package-manager, swift, ios, macos

## Member repositories
- marksands/BetterCodable (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:38.323629+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:21:49.572716+00:00, confidence not recorded.
  - readme: https://github.com/marksands/BetterCodable (fetched 2026-08-28T04:05:38.323629+00:00, sha 0c0b55a6bf2e)
  - homepage: http://marksands.github.io/2019/10/21/better-codable-through-property-wrappers.html (fetched 2026-08-29T11:00:39.397077+00:00, sha 9b5afe8a9292)
- Data as of 2026-08-30T08:39:29.467469+00:00.
