SwiftUI-Components
Ready-made SwiftUI views for iOS 17 and macOS 14, with form validation and accessible gestures
License: MIT
A dependency-free Swift package of SwiftUI views: buttons, cards, charts, form inputs with validation, gestures, lists, overlays, loaders and toasts. Each component is a plain View configured through its initializer, so you can use one or two without adopting a theme system. The logic behind them, such as card-number checks, validators, JSON form schemas and swipe and shape recognition, is covered by Swift Testing suites that run on macOS and an iPhone simulator.
Features
- 223 views, 12 view modifiers and 5 gesture modifiers in 14 categories, counted from the sources
- Composable validators, errors that appear after the first edit, debounced server checks and multi-step forms
- Forms rendered from JSON; schema patterns run with a 20 ms limit per match and a 100 ms budget per check
- Swipes, edge swipes, swipe sequences, pinch-rotate-drag and shape drawing, each with an accessibility action
- One code base for iOS and macOS: almost all UIKit-only details map to AppKit or to no-ops in one platform file
- Swift 6 language mode, no dependencies, and README samples compiled by the example app and the test target
- WCAG 2 contrast ratio and level for SwiftUI colors with ColorContrast
Quickstart
1import SwiftUI2import SwiftUIComponents3 4struct ContentView: View {5 @State private var rating = 3.06 7 var body: some View {8 VStack(spacing: 20) {9 Text("Rate this app")10 .font(.headline)11 RatingInput(rating: $rating)12 PrimaryButton("Send rating") {13 print("Rating: \(rating)")14 }15 }16 .padding()17 }18}Installation
Xcode (File › Add Package Dependencies…)
1https://github.com/muhittincamdali/SwiftUI-Components.gitSwift Package Manager
1dependencies: [2 .package(url: "https://github.com/muhittincamdali/SwiftUI-Components.git", from: "2.1.0")3],4targets: [5 .target(name: "YourApp", dependencies: [6 .product(name: "SwiftUIComponents", package: "SwiftUI-Components")7 ])8]Screenshots








Timeline
Repository opened; v1.0.0 tagged on the first commit (14 source files, iOS 16 and macOS 13)
Package slimmed down: the components were removed and replaced with placeholder code (c7b3799)
Rebuilt as 2.0.0: components restored for iOS 17 and macOS 14 in the Swift 6 language mode, with tests, CI and DocC (PR #3)
2.1.0: validation, JSON forms, gestures and a contrast checker, rewritten from SwiftUI-Forms-Kit, SwiftUI-Gesture-Library and iOSUIComponents, which were archived (PR #6)