tagomoris / LicenseList

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

Home Page:https://blog.cybozu.io/entry/2022/07/05/173000

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Requirements

  • Written in Swift 5.9
  • Compatible with iOS 14.0+
  • Developement with Xcode 15.0+

Installation

LicenseList is available through Swift Package Manager.

  1. Integrate LicenseList in your project
    • File > Add Packages...
    • Search https://github.com/cybozu/LicenseList.git
    • Choose LicenseList product and add it to your application target
  2. Link LicenseList in your application target
    • Application Target > General > Frameworks, Libraries, and Embedded Content > +
    • Choose LicenseList
  3. Add PrepareLicenseList plugin to build phases
    • Application Target > Build Phases > Run Build Tool Plug-ins > +
    • Choose PrepareLicenseList

Usage

Example for UIKit

import LicenseList

// in ViewController
let vc = LicenseListViewController()
vc.title = "LICENSE"

// If you want to anchor link of the repository
vc.licenseListViewStyle = .withRepositoryAnchorLink

navigationController?.pushViewController(vc, animated: true)

Example for SwiftUI

import LicenseList

struct ContentView: View {
    var body: some View {
        NavigationView {
            LicenseListView()
                // If you want to anchor link of the repository
                .licenseListViewStyle(.withRepositoryAnchorLink)
                .navigationTitle("LICENSE")
        }
    }
}

Demo

This repository includes demonstration app for UIKit & SwiftUI.

Open LicenseDemo/LicenseDemo.xcodeproj and Run it.

SourcePackagesParser (spp)

SourcePackagesParser 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 [output directory path] [SourcePackages directory path]
  • [output directory path]
    Path to the directory where the license-list.plist file will be placed.

  • [SourcePackages directory path]
    Example: ~/Library/Developer/Xcode/DerivedData/project-name-xxxxxxxx/SourcePackages

About

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

https://blog.cybozu.io/entry/2022/07/05/173000

License:MIT License


Languages

Language:Swift 100.0%