A clean, customizable, and production-ready settings UI kit for iOS apps — built entirely in SwiftUI.
This open-source library gives you polished components to build beautiful settings screens fast:
- ✅ Sections
- ✅ Toggles
- ✅ Disclosure groups
- ✅ Navigation rows
- ✅ Action buttons
- ✅ Theme-aware styles
- 🍎 Native SwiftUI 5 implementation
- 🎨 Configurable design via
SettingsStyle
- 🧩 Modular, reusable views
- 🧱 Composable architecture for building real-world settings screens
- 🌙 Dark mode support out of the box
Light Mode | Dark Mode |
---|---|
![]() |
![]() |
@State private var isOn = true
@State private var isOn2 = false
@State private var isDev = false
@State private var showAdvanced = true
SettingsSection(header: "General") {
SettingsToggleRow(title: "Enable Notifications", isOn: $isOn)
SettingsToggleRow(title: "Background Sync", subtitle: "Keeps data updated in background", isOn: $isOn2)
}
SettingsNavigationRow(title: "Appearance") {
AppearanceScreen()
}
SettingsDisclosureGroup(title: "Advanced", isExpanded: $showAdvanced) {
SettingsToggleRow(title: "Enable Dev Mode", isOn: $isDev)
}
SettingsButtonRow(title: "Log Out", role: .destructive) {
logout()
}
You can globally customize appearance by injecting a style into the environment:
.settingsStyle(
SettingsStyle(
titleFont: .callout,
subtitleFont: .caption,
titleColor: .primary,
subtitleColor: .gray,
rowVerticalPadding: 6,
destructiveColor: .red,
toggleTintColor: .blue
)
)
All components will adapt automatically via @Environment(\.settingsStyle)
.
The included demo app shows how to use every component in a real SwiftUI project:
@main
struct SettingsKitDemoApp: App {
var body: some Scene {
WindowGroup {
SettingsPreviewScreen()
}
}
}
Check out
SettingsPreviewScreen.swift
insideSettingsKitDemo/
to try the components live.
You can use Swift Package Manager to install SettingsKit in your project.
- Open your project in Xcode
- Go to File > Add Packages
- Enter this URL: https://github.com/1lyyfe/SwiftUI-SettingsKit
- Select version from: 1.0.0
dependencies: [
.package(url: "https://github.com/1lyyfe/SwiftUI-SettingsKit.git", from: "1.0.0")
]
Then add "SettingsKit" to your target dependencies.
This library includes a fully documented test suite using XCTest
to validate all components:
- ✅
SettingsToggleRowTests
- ✅
SettingsNavigationRowTests
- ✅
SettingsButtonRowTests
- ✅
SettingsDisclosureGroupTests
To run tests for the core SettingsKit
package:
- Open
Package.swift
directly in Xcode (not the demo app (SettingsKitDemo
) project (in theExamples
folder)) - Select the
SettingsKitTests
scheme - Press
⌘ + U
to run tests
❗️Note: If you open the demo app (
SettingsKitDemo.xcodeproj
) instead of the package,⌘ + U
will only run demo app tests — not the actual library tests.
cd path/to/SwiftUI-SettingsKit
swift test
This will build and run the full suite from the Tests/SettingsKitTests folder.
All tests are written without using fragile reflection. We simulate real SwiftUI usage through state and bindings to ensure reliability and future-proofing.
Example from SettingsDisclosureGroupTests.swift
:
func testDisclosureGroupHonorsBinding() {
var isExpanded = false
let binding = Binding<Bool>(
get: { isExpanded },
set: { isExpanded = $0 }
)
let group = SettingsDisclosureGroup(title: "Debug", isExpanded: binding) {
Text("Advanced Settings")
}
XCTAssertFalse(isExpanded)
}
MIT
Built with ❤️ by Haider Ashfaq
Want inspiration for your next indie iOS app?
💡 Check out 100 iOS App Ideas with MVP Scopes — a high-value guide made for SwiftUI engineers.
Follow Haider on Medium for upcoming articles, deeper SwiftUI dives, and full-stack dev projects.
Happy shipping 🚀