Skip to content

Latest commit

 

History

History
59 lines (53 loc) · 1.68 KB

README.md

File metadata and controls

59 lines (53 loc) · 1.68 KB

LicensePlugin

Generate License List that Project depends on.

// Package.swift
let package = Package(
  name: "SampleKit",
  products: [
    .library(
      name: "SampleKit",
      targets: ["SampleKit"]
    )
  ],
  dependencies: [
    .package(url: "https://github.com/zunda-pixel/LicenseProvider", from: "1.4.0"),
  ],
  targets: [
    .target(
      name: "SampleKit",
      plugins: [
        .plugin(name: "LicenseProviderPlugin", package: "LicenseProvider"),
      ]
    )
  ]
)
import SwiftUI

struct LicenseView: View {
  var body: some View {
    NavigationStack {
      List {
        ForEach(LicenseProvider.packages) { package in
          NavigationLink(package.name) {
            VStack {
              if case .remoteSourceControl(let location) = package.kind {
                Link("URL", destination: location)
              }
              Text(package.license)
            }
            .navigationTitle(package.name)
          }
        }
      }
    }
  }
}