Skip to content

mrtokii/LicenseListController

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LicenseListController

swift-package-manager

Simple and lightweight view controller for displaying licenses of used dependencies.

Data Sources

LicenseListController uses protocol LicenseEntrySource which defines a source of license entries. A LicenseEntry is a simple struct with dependency name and license text. You initialize LicenseListViewController with a list of data sources. All license entries are then combined and sorted alphabetically.

There are two built-in data sources:

  • CustomEntrySource: used to manually specify a list LicenseEntry's
  • LicensePlistEntrySource: this data source uses output .plist files, generated by LicensePlist pod. Do not forget to create folder references instead of groups into which .plist files are placed.

Quick Start

// Find all generated .plist files in BUNDLE_ROOT/Licenses
let plistSource = LicensePlistEntrySource(bundle: .main, path: "Licenses")

// Define some custom entries
let customSource = CustomEntrySource([
  .init(title: "My cool framework", text: "License text..."),
  .init(title: "SomeOtherDependency", text: "License text...")
])

// Create License List controller
let listController = LicenseListViewController(title: "Licenses", sources: [
  plistSource, customSource
])

// Wrap in Navigation Controller and present
let navigationController = UINavigationController(rootViewController: listController)      
present(navigationController, animated: true, completion: nil)

Customization

You may subclass LicenseListViewController and LicenseDetailsViewController to modify styles.

About

Simple and lightweight view controller for displaying licenses of used dependencies

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages