Swiftpack.co - mrtokii/LicenseListController as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mrtokii.
mrtokii/LicenseListController 1.0.1
Simple and lightweight view controller for displaying licenses of used dependencies
⭐️ 2
🕓 3 years ago
iOS
.package(url: "https://github.com/mrtokii/LicenseListController.git", from: "1.0.1")

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.

GitHub

link
Stars: 2
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics