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

cybozu/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

  • Development with Xcode 15.2+
  • Written in Swift 5.9
  • Compatible with iOS 14.0+

Privacy Manifest

This library does not collect or track user information, so it does not include a PrivacyInfo.xcprivacy file.

Installation

LicenseList is available through Swift Package Manager.

Xcode

  1. File > Add Package Dependencies…
  2. Search https://github.com/cybozu/LicenseList.git.
  3. Add package and link LicenseList to your application target.

CLI

  1. Create Package.swift that describes dependencies.
    // swift-tools-version: 5.9
    import PackageDescription
    
    let package = Package(
        name: "SomeProduct",
        products: [
            .library(name: "SomeProduct", targets: ["SomeProduct"])
        ],
        dependencies: [
            .package(url: "https://github.com/cybozu/LicenseList.git", exact: "0.7.0")
        ],
        targets: [
            .target(
                name: "SomeProduct",
                dependencies: [
                    .product(name: "LicenseList", package: "LicenseList")
                ]
            )
        ]
    )
  2. Run the following command in Terminal.
    $ swift package resolve

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.