Swift 6.0 iOS 18+ macOS 15+ visionOS 2+ MIT SPM

DesignFoundation

A production-grade SwiftUI design system. Token-based theming, protocol-driven style swapping, first-class Liquid Glass support, and a full component library — one dependency, instantly consistent across every screen.

DesignFoundation mirrors SwiftUI's own ButtonStyle pattern across every component. Inject a DFTheme once at the app root; every component reads its colors, typography, spacing, and radius from the nearest theme in the environment. Override any subtree. Write custom styles by implementing one function. Zero hardcoded values anywhere.

Installation

Xcode

File → Add Package Dependencies, paste the URL below, and choose Up to Next Major from version 1.0.0.

https://github.com/NerdSnipe-Inc/design-foundation

Package.swift

// Package.swift
dependencies: [
    .package(url: "https://github.com/NerdSnipe-Inc/design-foundation", from: "1.0.0")
],
targets: [
    .target(name: "YourApp", dependencies: ["DesignFoundation"])
]

Quick Start

import DesignFoundation

@main
struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .dfTheme(DFTheme(colors: DFColorTokens(primary: .indigo)))
        }
    }
}

// In any view:
DFButton("Get Started") { /* action */ }

DFTextField("Email", text: $email)
    .dfTextFieldStyle(.outlined)

DFCard {
    DFText("Hello", style: .headline)
}

DFTheme

A single DFTheme struct propagates through SwiftUI's environment. Inject it once at the root and every component responds automatically. Override at any subtree depth.

ContentView()
    .dfTheme(DFTheme(
        colors: DFColorTokens(
            primary: .indigo,
            surface: Color(.systemBackground)
        ),
        spacing: DFSpacingTokens(md: 20),
        radius: DFRadiusTokens(md: 12)
    ))
Subtree overrides — wrap any view in .dfTheme(...) to apply a different palette to just that section (e.g. a dark hero banner inside a light screen).

Tokens

Every component reads exclusively from these token namespaces — no hardcoded values anywhere in the library.

Colors — theme.colors

TokenPurpose
.primaryBrand / interactive accent
.surfaceCard and panel backgrounds
.surfaceElevatedRaised overlays, popovers
.textPrimaryBody and heading text
.textSecondaryLabels, placeholders, captions
.textDisabledDisabled control labels
.borderStrokes, dividers
.interactiveFillInput field backgrounds
.destructiveDelete, danger actions
.success / .warning / .infoSemantic status colors

Spacing — theme.spacing

TokenDefault
.xs4 pt
.sm8 pt
.md12 pt
.lg16 pt
.xl24 pt
.xxl32 pt

Radius — theme.radius

TokenDefault
.none0
.sm4 pt
.md8 pt
.lg12 pt
.full9999 pt (pill)

Typography — theme.typography

TokenUsage
.display.fontHero headlines
.title.fontScreen titles
.headline.fontSection headers
.body.fontBody text
.caption.fontLabels, helper text
.label.fontSmall UI labels

Style System

Every component exposes a style protocol with a single makeBody(configuration:) method — the same pattern as SwiftUI's ButtonStyle. Styles propagate through the environment, compose with each other, and apply hierarchically.

// Apply a style to an entire section
VStack { ... }
    .dfButtonStyle(.outlined)
    .dfCardStyle(.glass)

// Override for a single component
DFButton("Delete", role: .destructive) { }
    .dfButtonStyle(.ghost)

// Liquid Glass across your whole UI (iOS/macOS 26+)
ContentView()
    .dfButtonStyle(.glass)
    .dfCardStyle(.glass)
    .dfTooltipStyle(.glass)

Writing a custom style means implementing one function. All protocols are open; built-in styles are concrete structs you can copy and fork.

struct MyButtonStyle: DFButtonStyle {
    func makeBody(configuration: DFButtonStyleConfiguration) -> some View {
        configuration.label
            .padding(.horizontal, configuration.theme.spacing.lg)
            .background(configuration.theme.colors.primary)
            .clipShape(Capsule())
            .opacity(configuration.isPressed ? 0.7 : 1)
    }
}

Primitives

ComponentBuilt-in Styles
DFButton.filled .outlined .ghost .tinted .glass¹
DFTextdisplay, title, headline, body, caption, label
DFIconSF Symbol wrapper with token-driven size and color
DFBadge.default .subtle .outlined .glass¹
DFAvatar.circle .rounded .ring .glass¹ — image or initials, presence indicators
DFDivider.solid .dashed .gradient — horizontal/vertical, labeled variant

Inputs

All input components share DFValidationState (.idle / .valid / .error(String)) for consistent error display.

ComponentBuilt-in Styles / Notes
DFTextField.outlined .filled
DFSecureField.outlined .filled — reveal toggle built in
DFToggle.switch .checkbox
DFSlider.standard .labeled
DFPicker.segmented .menu .wheel
DFDatePicker.compact .graphical .wheel
DFCheckbox.default

Layout

ComponentBuilt-in Styles
DFCard.elevated .outlined .filled .glass¹

Overlays

ComponentBuilt-in Styles
DFModal.standard .glass¹
DFSheet.standard .compact .glass¹
DFPopover.arrow .compact .glass¹
DFTooltip.bubble .glass¹

Supplementary

ComponentNotes
DFAlertConvenience wrapper over native SwiftUI alert
DFToastQueue management and auto-dismiss
DFSkeletonShimmer animation placeholder
DFProgressBarLinear, circular, and indeterminate variants
DFListRowLeading/trailing slots and disclosure indicator
DFListSwipe-delete, reorder, and multi-select
DFTableSortable columns

¹ .glass styles require iOS 26+ / macOS 26+.


Add-on Packages

DesignFoundation is the free, open-source foundation. Two commercial packages build on top — blocks for common UI patterns, screens for complete vertical feature sets. All three share the same DFTheme, so a brand color change ripples through everything identically.

DesignFoundationPro

29 drop-in blocks — auth flows, onboarding, dashboards, forms, settings, and more. One typed Configuration struct per block.

Browse Pro →

DesignFoundationScreens

Complete, wired-up screen verticals — e-commerce, CRM, project management, and more. Drop in a screen, pass a Configuration, connect your data layer.

Browse screens →

Installation

Add whichever packages you need alongside DesignFoundation:

// Package.swift
dependencies: [
    .package(url: "https://github.com/NerdSnipe-Inc/design-foundation", from: "1.0.0"),
    // optional commercial packages
    .package(url: "https://github.com/NerdSnipe-Inc/design-foundation-pro", from: "1.0.0"),
    .package(url: "https://github.com/NerdSnipe-Inc/design-foundation-screens", from: "1.0.0"),
]

Get access →


Platforms

PlatformMinimum Version
iOS18.0
macOS15.0
visionOS2.0

.glass styles require iOS 26+ / macOS 26+. All other styles work on the minimum versions above.

License

MIT © 2026 NerdSnipe Inc. DesignFoundation is free and open-source. View LICENSE →