Generate a list of licenses for the Swift Package libraries that your app depends on.
Example
- Written in Swift 5.9
- Compatible with iOS 14.0+
- Developement with Xcode 15.0+
LicenseList is available through Swift Package Manager.
- 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
- Link LicenseList in your application target
- Application Target >
General
>Frameworks, Libraries, and Embedded Content
>+
- Choose
LicenseList
- Application Target >
- Add PrepareLicenseList plugin to build phases
- Application Target >
Build Phases
>Run Build Tool Plug-ins
>+
- Choose
PrepareLicenseList
- Application Target >
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)
import LicenseList
struct ContentView: View {
var body: some View {
NavigationView {
LicenseListView()
// If you want to anchor link of the repository
.licenseListViewStyle(.withRepositoryAnchorLink)
.navigationTitle("LICENSE")
}
}
}
This repository includes demonstration app for UIKit & SwiftUI.
Open LicenseDemo/LicenseDemo.xcodeproj and Run it.
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.
$ 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