Getting Started/Installation

Installation

SwiftDS can be used in two ways: as a Swift Package (recommended for full projects) or by copying individual component files directly into your codebase. Both approaches work with no additional dependencies beyond SwiftUI itself.

Option A — Swift Package Manager (Recommended)

The fastest way to get the full system into any Xcode project. Includes all components, tokens, and the interactive Showcase app.

1

Open your Xcode project

Go to File → Add Package Dependencies (or File → Swift Packages → Add Package Dependency on older Xcode).

2

Paste the repository URL

In the search field, enter the repository URL and press Return.

3

Select the version rule

Choose "Up to Next Major Version" starting from 2.0.0. Click Add Package.

4

Link the library to your target

Under "Add to Target", select your app target. Click Add Package to confirm.

Package.swift — adding as a dependency
// If you already have a Package.swift in your project:
dependencies: [
    .package(
        url: "https://github.com/luizmellodev/SwiftDS-package.git",
        from: "2.0.0"
    )
],
targets: [
    .target(
        name: "YourApp",
        dependencies: [
            .product(name: "DesignSystem", package: "SwiftDS")
        ]
    )
]
Import in any SwiftUI file
import SwiftDS

struct ContentView: View {
    @State private var name = ""

    var body: some View {
        VStack(spacing: DSSpacing.md) {
            DSTextField(label: "Name", placeholder: "Type here...", text: $name)
            DSButton("Continue", variant: .primary) {
                // action
            }
        }
        .padding(DSSpacing.xl)
    }
}

Option B — Copy individual files (no install required)

If you prefer not to add a package dependency — or just want to try a single component — you can copy any .swift file directly into your Xcode project. The only requirement is that you also copy DSTokens.swift and DSTypography.swift, since every component depends on the token system.

Minimum required files for any component

DSTokens.swiftColors, spacing, radius, shadows, animations
DSTypography.swiftText styles and DSText component
DSButton.swiftOr any other component file you need

Note

When copying files manually, remove the import SwiftDS statement at the top — the code lives directly in your module. No other changes are needed.

What's Included

SwiftDS includes everything you need to build production-ready apps:

118+ Components

Buttons, inputs, cards, navigation, analytics, dashboards, and more. All components are production-ready with full accessibility support.

ButtonsInputsCardsNavigationAnalyticsMore

Design Tokens

Centralized color, spacing, typography, and animation tokens. Change once, update everywhere.

ColorsSpacingTypographyAnimations

6 Showcase Apps

Complete example apps demonstrating real-world usage: Todo List, Travel Organizer, AI Chat, and more.

View Gallery →

100% Accessible

Full VoiceOver support, keyboard navigation, Dynamic Type, and WCAG AA compliance built into every component.

Learn More →

Quick Start Example

Once installed, you can start using SwiftDS components immediately. Here's a simple login screen example:

ContentView.swift — Simple login screen
import SwiftUI
import SwiftDS

struct LoginView: View {
    @State private var email = ""
    @State private var password = ""
    @State private var isLoading = false
    
    var body: some View {
        VStack(spacing: DSSpacing.lg) {
            // Header
            VStack(spacing: DSSpacing.sm) {
                Text("Welcome Back")
                    .font(DSTypography.title1)
                    .foregroundColor(.dsForeground)
                
                Text("Sign in to continue")
                    .font(DSTypography.body)
                    .foregroundColor(.dsForegroundMuted)
            }
            .padding(.bottom, DSSpacing.xl)
            
            // Form
            VStack(spacing: DSSpacing.md) {
                DSTextField(
                    label: "Email",
                    placeholder: "your@email.com",
                    text: $email,
                    leadingIcon: "envelope"
                )
                
                DSSecureField(
                    label: "Password",
                    placeholder: "Enter your password",
                    text: $password,
                    leadingIcon: "lock"
                )
            }
            
            // Actions
            DSButton(
                "Sign In",
                variant: .primary,
                size: .lg,
                isLoading: isLoading,
                isFullWidth: true
            ) {
                handleLogin()
            }
        }
        .padding(DSSpacing.xl)
    }
    
    private func handleLogin() {
        isLoading = true
        // Your login logic here
    }
}

Requirements

15.0+

Xcode

5.10+

Swift

17+

iOS

14+

macOS

10+

watchOS

Platform Support

SwiftDS supports iOS 17+, macOS 14+, watchOS 10+, tvOS 17+, and visionOS 1+. All components are designed to work seamlessly across all Apple platforms with automatic adaptations for each platform's design patterns.

License & Credits

License

SwiftDS is released under the MIT License. You are free to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the software, provided that the copyright notice and permission notice appear in all copies.

Attribution

Attribution is not required but always appreciated. If you use SwiftDS in a public project or product, a mention — in your README, about screen, or release notes — helps the community grow.

Contributing

Pull requests and issues are welcome on GitHub. Please follow the existing code style and ensure new components include a Xcode Preview and a usage example.