SkillAgentSearch skills...

AckGen

Generate a list of license information for all Swift packages used in your project. For easy *Acknowledgement* views.

Install / Use

/learn @MartinP7r/AckGen
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

AckGen

Simple Acknowledgements Generator for SPM package license information.

Overview

AckGen automatically generates a plist file containing the title and license information for all Swift packages used in your project.
This can be used to feed a SwiftUI List or UITableView dataSource in your app.

| | | | -------------------------- | ----------------------- | | | |

Requirements

  • Xcode 12+ (tested with 12.5)

Installation

  1. Add AckGen as a dependency for your project in Xcode.

Warning Leave the checkbox for executable unchecked

  1. Add the following as a Run Script for your target in Xcode
# Calculate the package path dynamically (handles "Build" in usernames/project paths)
BASE_DIR="${PROJECT_TEMP_DIR%/Build/*}"
DIR="$BASE_DIR/SourcePackages/checkouts/AckGen"

if [ -d "$DIR" ]; then
  cd "$DIR"
  SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
  swift run ackgen
else
  echo "warning: AckGen not found. Please install the package via SPM (https://github.com/MartinP7r/AckGen#installation)"
fi

Make sure to set ENABLE_USER_SCRIPT_SANDBOXING to NO in your build settings so the build phase above can write to the desired destination.

If you want the plist file to be saved somewhere other than Acknowledgements.plist at the root of your project ($SRCROOT/Acknowledgements.plist), you can provide a custom output path:

  swift run ackgen --output "$SRCROOT/PackageLicenses.plist"

To generate a Settings.bundle-compatible plist instead, use the --settings flag:

  swift run ackgen --output "$PLIST_PATH" --settings --title "MyApp"

Run swift run ackgen --help for all available options.

  1. Add the generated plist file to your project if you haven't already.
    Make sure to remove the check for Copy items if needed

  2. You can now simply use the plist file however you like or use the Acknowledgement model for convenience:

import AckGen
// ...
let acknowledgements: [Acknowledgement] = Acknowledgement.all()
acknowledgements.forEach { print($0.title, $0.license) }

Settings.bundle Integration

AckGen can generate acknowledgements in a format compatible with iOS Settings.bundle, allowing users to view package licenses directly in the iOS Settings app.

Setup

  1. Create a Settings.bundle in your Xcode project if you don't have one already (File → New → File → Settings Bundle).

  2. In your Settings.bundle's Root.plist, add a child pane specifier that points to the acknowledgements:

<dict>
    <key>Type</key>
    <string>PSChildPaneSpecifier</string>
    <key>File</key>
    <string>Acknowledgements</string>
    <key>Title</key>
    <string>Acknowledgements</string>
</dict>
  1. Add a Run Script build phase that generates the acknowledgements file in Settings.bundle format:
DIR=$PROJECT_TEMP_DIR/../../../SourcePackages/checkouts/AckGen
if [ -d "$DIR" ]; then
    cd $DIR
    SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
    SETTINGS_BUNDLE=$(find "$SRCROOT" -type d -name "Settings.bundle" -print -quit)
    
    if [ -d "$SETTINGS_BUNDLE" ]; then
        PLIST_PATH="$SETTINGS_BUNDLE/Acknowledgements.plist"
        PROJECT_NAME=$(basename "$SRCROOT")
        swift run ackgen --output "$PLIST_PATH" --settings --title "$PROJECT_NAME"
    else
        echo "warning: Settings.bundle not found in the project."
    fi
else
    echo "warning: AckGen not found. Please install the package via SPM (https://github.com/MartinP7r/AckGen#installation)"
fi

The command options:

  • --output: Where to save the plist file (e.g., $SETTINGS_BUNDLE/Acknowledgements.plist)
  • --settings: Generate Settings.bundle compatible format
  • --title (optional): The title for the acknowledgements section (defaults to "Acknowledgements")
  1. Make sure the generated Acknowledgements.plist is ignored in your .gitignore (e.g., Settings.bundle/Acknowledgements.plist) as it will be regenerated on each build.

The acknowledgements will now appear in your app's Settings screen.

UI

Optionally, there's a basic SwiftUI AcknowledgementsList component (see gif above) included in the AckGenUI module that you can use to quickly create a generic list of acknowledgements to embed into a NavigationView.

import AckGenUI
import SwiftUI

struct ContentView: View {
    var body: some View {
        NavigationView {
            AcknowledgementsList()
        }
    }
}

Beta

Until 1.0 is reached, minor versions will be breaking.

Contribution

This is my first stab at building a Swift package and was mainly intended to be an exercise.
I hope, however, that it can be useful to someone other than me.

If you encounter any problems or have suggestions, additions or possible improvements to share, you are more than welcome to open a PR or issue and I'll get back to you as soon as my time allows it.

Setup Example App

make bootstrap
make open

TODO

  • [ ] Add non-SPM licenses separately
  • [x] Add UI components (SwiftUI List with NavigationLink to license info?)
  • [ ] Allow Run Script Output Files as alternative to command line argument
  • [ ] Allow to specify excluded packages
  • [x] Add tests
  • [ ] Add other platforms
View on GitHub
GitHub Stars43
CategoryDevelopment
Updated4d ago
Forks11

Languages

Swift

Security Score

95/100

Audited on Mar 25, 2026

No findings