Skip to content

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

License

Notifications You must be signed in to change notification settings

charlie-dev-ios/LicenseList

 
 

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%