# sunshinejr/SwiftyUserDefaults

Modern Swift API for NSUserDefaults

Repository: https://github.com/sunshinejr/SwiftyUserDefaults
Canonical: https://ross.abutalabs.com/products/swiftyuserdefaults
Homepage: http://radex.io/swift/nsuserdefaults/static
Language: Swift
License: MIT
License Family: permissive
Topics: swift, swifty, nsuserdefaults, ios
Last push: 2024-03-25T03:48:17+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": 4243, "days_push": 891, "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 4888, forks 362 (observed 2026-08-28T04:09:01.950281+00:00)

## What it is
A Swift library providing a modern, statically-typed API over NSUserDefaults (UserDefaults). It lets developers define typed keys in one place and read/write preferences with compile-time safety and expressive syntax.

## Use cases
- store user preferences in an iOS app with type safety
- define UserDefaults keys in one place to avoid stringly-typed code
- increment a launch counter stored in UserDefaults
- persist Codable custom types to user defaults
- observe preference changes with KVO
- use property wrappers for app settings

## When to choose
- you're building an iOS, macOS, watchOS, or tvOS app in Swift and want a safer UserDefaults API
- you want compile-time checks and typed keys instead of raw string keys
- you want convenient support for Codable, RawRepresentable, and custom types in defaults

## When to avoid
- you need a full database or sync engine rather than simple key-value preferences
- your project targets platforms outside Apple's ecosystem
- you prefer the native UserDefaults API or a Swift property-wrapper-only solution like @AppStorage
- you need a library under very active development, as the project appears to be in maintenance mode

## Facets
- artifact type: library
- maturity: maintenance
- function: developer-tools, serialization
- domain: mobile-development, developer-tools, apple-ecosystem
- platform: cross-platform
- tags: userdefaults, swift, statically-typed, preferences, key-value-storage, property-wrappers, ios, macos

## Member repositories
- sunshinejr/SwiftyUserDefaults (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:01.950281+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-29T18:18:12.829018+00:00, confidence not recorded.
  - readme: https://github.com/sunshinejr/SwiftyUserDefaults (fetched 2026-08-28T04:09:01.950281+00:00, sha 04454a16a128)
  - homepage: http://radex.io/swift/nsuserdefaults/static (fetched 2026-08-29T09:00:33.263100+00:00, sha 7cf9fdc3df2e)
  - site_page: https://radex.io/about (fetched 2026-08-29T09:00:33.266840+00:00, sha d37660ce9d72)
  - site_page: https://radex.io/about/llm-policy (fetched 2026-08-29T09:00:33.268558+00:00, sha 6996c88aa11b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
