PreferenceKit

0.0.7

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.0.7

2026-10-04T18:51:52Z
  • Make the package and test suite compatible with Linux builds.
  • Update CI to use supported checkout actions and a stable Ubuntu runner.
  • Document app privacy purpose strings and localization requirements.

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"),
    ]),
]

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",
            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 the host app declares a supported nonempty privacy usage description in its Info.plist, PreferenceKit also adds a Privacy destination. It lists the declared capabilities, shows each system-prompt reason, and links to Settings where the platform supports changing the permission. Notifications are included after the app has requested notification authorization, because Apple does not use an Info.plist usage-description key for that capability. Each detail view also 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.

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.
privacyContent Adds a custom row or section in the Privacy destination.
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

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 08 2026 02:01:39 GMT-1000 (Hawaii-Aleutian Standard Time)