PreferenceKit

0.1.0

PreferenceKit provides a ready-made SwiftUI settings screen with application information, update links, acknowledgements, changelog entries, support feedback, privacy policy links, and developer social-media links.
0xWDG/PreferenceKit

What's New

0.1.0

2026-11-20T12:47:30Z

Add roadmap

PreferenceKit

PreferenceKit provides a ready-made SwiftUI settings screen with application information, update links, acknowledgements, changelog entries, support feedback, privacy policy links, and developer social-media links.

Swift Package Manager License

Requirements

  • Swift 6.0+ (Xcode 16+)
  • iOS 15+, macOS 12+, watchOS 8+, tvOS 15+

Installation (Package.swift)

dependencies: [
    .package(url: "https://github.com/0xWDG/PreferenceKit.git", branch: "main"),
],
targets: [
    .target(name: "MyTarget", dependencies: [
        .product(name: "PreferenceKit", package: "PreferenceKit"),
        // Add only the privacy products used by this app.
        .product(name: "PreferenceKitCamera", package: "PreferenceKit"),
    ]),
]

Installation (Xcode)

  1. In Xcode, open your project and navigate to File > Swift Packages > Add Package Dependency...
  2. Paste the repository URL (https://github.com/0xWDG/PreferenceKit) and click Next.
  3. Click Finish.

Usage

import SwiftUI
import PreferenceKit

struct ContentView: View {
    @State private var sendsDiagnostics = true

    var body: some View {
        PreferenceKit(
            createdBy: "[Example Studio](https://example.com)",
            privacyPolicyURL: URL(string: "https://example.com/privacy"),
            supportEmail: "support@example.com",
            roadmapURL: URL(string: "https://wesleydegroot.nl/roadmap/PreferenceKit"),
            socialMediaLinks: [
                .init(platform: .github, profile: "example"),
                .init(platform: .mastodon, profile: "@example@mastodon.social"),
                .init(platform: .website, profile: "https://example.com")
            ],
            changeLog: [
                .init(version: "1.2.0", date: "2026-09-24", text: "Improved settings.")
            ],
            acknowledgements: [
                .init(
                    name: "Example Dependency",
                    copyright: "Example Authors",
                    licence: "MIT",
                    url: "https://github.com/example/dependency"
                )
            ]
        ) {
            Section("Support") {
                Toggle("Include diagnostics in feedback", isOn: $sendsDiagnostics)
            }
        } bottomContent: {
            Section {
                Text("Thanks for using Example App.")
            }
        }
    }
}

privacyPolicyURL is displayed in an in-app web view where supported; on other platforms or OS versions, PreferenceKit opens the URL in the system browser. When a configured capability has a supported nonempty privacy usage description in the host app's Info.plist, PreferenceKit adds a Privacy destination. It lists those selected capabilities, shows each system-prompt reason, and links to Settings where the platform supports changing the permission. Notifications have no Info.plist usage-description key and are shown whenever their product is configured. Each detail view shows the current authorization status without requesting access.

Privacy purpose strings belong to the consuming app's Info.plist. They must truthfully describe the feature that accesses the protected data; see the privacy-permissions guide for the required keys and examples.

Each protected framework is an opt-in product. Add only the products used by your app, then import them and pass their capabilities to PreferenceKit. This prevents an unused protected framework from being linked into the final binary.

import PreferenceKit
import PreferenceKitCamera
import PreferenceKitPhotos

PreferenceKit(
    changeLog: nil,
    acknowledgements: nil,
    privacyPermissions: [.camera, .photos]
)
Capability Product Value Purpose-string key
Camera PreferenceKitCamera .camera NSCameraUsageDescription
Microphone PreferenceKitMicrophone .microphone NSMicrophoneUsageDescription
Photos PreferenceKitPhotos .photos NSPhotoLibraryUsageDescription
Location PreferenceKitLocation .location NSLocationWhenInUseUsageDescription
Contacts PreferenceKitContacts .contacts NSContactsUsageDescription
Calendar PreferenceKitCalendar .calendar NSCalendarsFullAccessUsageDescription
Reminders PreferenceKitReminders .reminders NSRemindersFullAccessUsageDescription
Speech Recognition PreferenceKitSpeechRecognition .speechRecognition NSSpeechRecognitionUsageDescription
Notifications PreferenceKitNotifications .notifications None

Configuration

All configuration is optional except changeLog and acknowledgements, which accept nil when the corresponding row should be hidden.

Parameter Effect
createdBy Displays an attributed Markdown link below the app name.
privacyPolicyURL Adds a Privacy Policy row.
privacyPermissions Selected capabilities from imported privacy products.
privacyContent Adds a custom row or section in the Privacy destination.
roadmapURL Adds a roadmap URL for planned features and updates.
supportEmail Adds a Feedback row and includes app and diagnostic details.
socialMediaLinks Adds links for developer profiles and communities.
changeLog Adds a Changelog destination.
acknowledgements Adds an Acknowledgements destination.
topContent / bottomContent Places your own Section views around the built-in content.

Use a platform-specific profile identifier for social media when possible—for example, "example" for GitHub or "@example@mastodon.social" for Mastodon. You can also pass a complete HTTP or HTTPS URL for custom community, invite, or profile destinations.

See the DocC usage guide and configuration reference for details.

Screenshot

image

Roadmap

You can display a roadmap for planned features and updates by providing a URL using the roadmapURL configuration parameter. The roadmap URL should point to a JSON file containing the planned features and updates.

Required fields:

Field Description
id Unique identifier for the issue or feature request.
title Title of the issue or feature request.
description Detailed description of the issue or feature request.
state Current state of the issue or feature request (e.g., "open").
comments Array of comments related to the issue or feature request.
opened_date Date when the issue or feature request was opened.
last_updated Date when the issue or feature request was last updated.
tags Array of tags associated with the issue or feature request.

The JSON should contain an array of roadmap items in this format:

[
    {
        "id": 1,
        "title": "Title of the issue or feature request",
        "description": "Description of the issue or feature request",
        "state": "open",
        "comments": ["This could be a comment about the issue or feature request"],
        "opened_date": "2026-01-15T10:00:00Z",
        "last_updated": "2026-02-02T14:30:00Z",
        "tags": ["the", "tags"]
    }
]

Contact

https://wesleydegroot.nl

Interested learning more about Swift? Check out my blog.

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

Last updated: Sun Nov 29 2026 02:03:52 GMT-1000 (Hawaii-Aleutian Standard Time)