Generate a list of licenses for the Swift Package libraries that your app depends on.

Overview

LicenseList

Generate a list of licenses for the Swift Package libraries that your app depends on.

Github issues Github forks Github stars Top language Release Github license

Example

top mit apache

Requirements

  • Written in Swift 5
  • Compatible with iOS 13.0+
  • Developement with Xcode 13.0+

Installation

LicenseList is available through Swift Package Manager.

Xcode

  1. Select File > Add Packages...
  2. Search https://github.com/cybozu/LicenseList.git
  3. Add Package (add LicenseList library to target but don't add spp executable to target).

Usage

  1. Create license-list.plist at the project root directory and add it to the project as a bundle resource.

    $ cd [project root path]
    $ echo '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict></dict></plist>' > license-list.plist

    ⚠️ Note: When you add license-list.plist to the project, you mast remove the check mark from "Copy items if needed".

  2. Add Run Script to the Build Phase of the Target.

    SOURCE_PACKAGES_PATH=`echo ${BUILD_DIR%Build/*}SourcePackages`
    
    # Build SourcePackagesParser
    xcrun --sdk macosx swift build -c release \
      --package-path ${SOURCE_PACKAGES_PATH}/checkouts/LicenseList \
      --product spp
    
    # Run SourcePackagesParser
    ${SOURCE_PACKAGES_PATH}/checkouts/LicenseList/.build/release/spp ${SRCROOT} ${SOURCE_PACKAGES_PATH}

    ⚠️ Note: This "Run Script" should be added before the "Copy Bundle Resources" step.

  3. Coding (Example)

    • with UIKit

      import LicenseList
      
      // in ViewController
      let fileURL = Bundle.main.url(forResource: "license-list", withExtension: "plist")!
      let vc = LicenseListViewController(fileURL: fileURL)
      vc.title = "LICENSE"
      navigationController?.pushViewController(vc, animated: true)
    • with SwiftUI

      import LicenseList
      
      struct ContentView: View {
          let url = Bundle.main.url(forResource: "license-list", withExtension: "plist")!
      
          var body: some View {
              NavigationView {
                  LicenseListView(fileURL: url)
                      .navigationTitle("LICENSE")
              }
          }
      }

SourcePackagesParser (spp)

SourcePackageParser is a command line tool that parses the license information of the Swift Package libraries on which the project depends based on workspace-state.json inside the DerivedData directory.

Usage

$ swift run spp [base directory path] [SourcePackages directory path]
  • [bese directory path]

    Path of the directory where the license-list.plist file will be placed.

  • [SourcePackages directory path]

    Example: ~/Library/Developer/Xcode/DerivedData/project-name-xxxxxxxx/SourcePackages

You might also like...
PrettyBorder is a SwiftUI package for managing an customized border and background at any kind of view.
PrettyBorder is a SwiftUI package for managing an customized border and background at any kind of view.

PrettyBorder Description PrettyBorder is a SwiftUI package for managing an customized border and background at any kind of view. Preview of end result

URLImage is a package that holds an easy way of showing images from an URL.
URLImage is a package that holds an easy way of showing images from an URL.

URLImage Overview URLImage is a package that holds an easy way of showing images from an URL. Usually this processes should take the following process

PerFolderResourcesPublishPlugin - Per-folder resources plugin for the Publish package

Per-folder resources for Publish A Publish plugin that copies per-folder resourc

Shows your photo library grouped by events, to easily export them to your computer
Shows your photo library grouped by events, to easily export them to your computer

Groupir Shows your photo library grouped by events, to easily export them to your computer Features Currently supported features: reading your photo l

Lightbox is a convenient and easy to use image viewer for your iOS app
Lightbox is a convenient and easy to use image viewer for your iOS app

Lightbox is a convenient and easy to use image viewer for your iOS app, packed with all the features you expect: Paginated image slideshow. V

GIFImage component for your SwiftUI app!
GIFImage component for your SwiftUI app!

SwiftUI GIF Lightweight SwiftUI component for rendering GIFs from data or assets, with no external dependencies. As a bonus, there's an extension that

ImagePicker : an all-in-one camera solution for your iOS app
ImagePicker : an all-in-one camera solution for your iOS app

Description ImagePicker is an all-in-one camera solution for your iOS app. It lets your users select images from the library and take pictures at the

An app show your Live Photo and export as GIF.
An app show your Live Photo and export as GIF.

LivelyGIFs Show your Live Photo and export as GIF. Demo HighLights Do not use Pod or Cathage to install 3rd party library Simple logic, new learner fr

PhotoEditor SDK: A fully customizable photo editor for your app.

About PhotoEditor SDK for iOS Our SDK provides tools for adding photo editing capabilities to your iOS application with a big variety of filters that

Comments
  • Artifact Bundleをリリースに含めてほしい

    Artifact Bundleをリリースに含めてほしい

    Package Pluginからもぜひ利用したいため、リリースにartifact bundleを含める運用をお願いしたいです。 参考までにこちらでArtifact Bundleを実際に作ってみました。(参考: https://theswiftdev.com/introduction-to-spm-artifact-bundles/ )

    またフォーク先で独自にリリースを作り、実際に以下のPluginを書くことでplistが書き出されていることを確認することができました。

    import Foundation
    import PackagePlugin
    
    @main
    struct LicenseListPlugin: BuildToolPlugin {
        func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
            let regex = try! NSRegularExpression(pattern: ".*SourcePackages")
            let pluginWorkDirectory = context.pluginWorkDirectory.string
            guard let matchRange = regex.firstMatch(in: pluginWorkDirectory, range: NSRange(0..<pluginWorkDirectory.count))?.range(at: 0) else {
                print("Failed match")
                return []
            }
            let sourcePackageDirectory = NSString(string: pluginWorkDirectory).substring(with: matchRange)
            
            return [
                .prebuildCommand(
                    displayName: "LicenseList",
                    executable: try context.tool(named: "spp").path,
                    arguments: [
                        target.directory.string,
                        sourcePackageDirectory,
                    ],
                    environment: [:],
                    outputFilesDirectory: context.pluginWorkDirectory
                )
            ]
        }
    }
    

    Package.swiftでは以下のように指定しています。

    var package = Package(
        targets: [
            .target(
                name: "SomeFeature",
                resources: [.process("license-list.plist")],
                plugins: [.plugin(name: "LicenseListPlugin")]
            ),
            .plugin(
                name: "LicenseListPlugin",
                capability: .buildTool(),
                dependencies: [
                    .target(name: "licenselist")
                ]
            ),
            .binaryTarget(
                name: "licenselist",
                url: "https://github.com/touyou/LicenseList/releases/download/0.1.5/licenselist.artifactbundle.zip",
                checksum: "02d1b096c60dd0a4f3ff67a6ec82d801c6a609867fc84aa9ad40d00b42395417"
            )
        ]
    )
    
    opened by touyou 4
Releases(0.2.0)
Owner
Cybozu
Open source products from Cybozu
Cybozu
IconsMaker - Create your app icon with SwiftUI and generate PNG images in all needed sizes

IconsMaker - Create your app icon with SwiftUI and generate PNG images in all needed sizes

Jonathan Gander 14 Oct 20, 2022
SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.

SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.

null 8.3k Jan 5, 2023
Generate random user Avatars for apps.

Avatar Generate random user Avatars for apps. Works for iOS 9.3+ Installation Simply install using Cocoapods, add 'pod Avatar' to your podfile Simple

William Vabrinskas 24 Nov 3, 2022
React-native-image-generator - Library to generate images from layers

react-native-image-generator Library for generate images from other images Insta

Evgeny Usov 13 Nov 16, 2022
🎨 Mondrian is lightweight Swift package that provides a universal basis for your design system's color palette.

??‍?? Mondrian Mondrian provides a universal basis on which to build your design system's color palette right from your codebase. With support for all

Klaas Schoenmaker 1 Nov 24, 2021
Shows a list of albums initially and shows the image in detailed view.

Description : PhotosViewer Shows a list of albums initially. Selcting any album will lead to a photos list screen Tapping on any photo will display a

null 0 Dec 27, 2021
This package integrates a UIImagePickerController into a SwiftUI app.

This Swift Package integrates a UIImagePickerController into a SwiftUI app and allows a user to select, scale and position an image to be cropped and saved as a conatct's photo, similar to the stock iOS Contacts app.

Rillieux 58 Dec 26, 2022
Swift Package Manager command plugin for Swift-DocC

Swift-DocC Plugin The Swift-DocC plugin is a Swift Package Manager command plugin that supports building documentation for SwiftPM libraries and execu

Apple 225 Dec 24, 2022
DittoSwift - Swift package for the DittoSwift framework

DittoSwift Swift package for the DittoSwift framework. See the Ditto iOS Install

Ditto 6 Sep 23, 2022
Swift Package Manager plug-in to compile Metal files that can be debugged in Xcode Metal Debugger.

MetalCompilerPlugin Swift Package Manager plug-in to compile Metal files that can be debugged in Xcode Metal Debugger. Description Swift Package Manag

Jonathan Wight 10 Oct 30, 2022