许可证 2.2

许可证 2.2

Mahmud Ahsan维护。




许可证

CocoaPods swift 4.0 CocoaPods Swift Package Manager Twitter: @mahmudahsan

快速展示第三方库及其许可,这些许可用于开发应用程序。大多数开源许可证的常见条款是:“上述版权声明和本许可声明应包含在所有副本或软件的实质性部分中。”

通常,当我们在开发应用程序时,我们会使用几个开源库。因此,这个基于属性列表的用户界面库将有助于轻松集成,并在应用程序的部分中展示它们。

该库有2种方式来展示信用。如果选择了 .DESC 风格,那么将展示您提供的许可证描述。如果是 .URL 风格,当用户点击时,将重定向到查看许可证的 URL。

Licenses Preview Licenses Preview

功能

  • 展示带有许可证的开源库名称
  • 基于属性列表的数据集成
  • 委托以集成分析
  • 展示许可证描述或打开 URL(两种方式)
  • 在 iOS 应用程序中工作

示例:显示描述

在 UIViewController 中进行集成

let bundle = Bundle(for: LicensesViewController.self)
let storyboard = UIStoryboard(name: "Licenses", bundle: bundle)

let licenseVC = storyboard.instantiateInitialViewController() as! LicensesViewController
licenseVC.title = "Licenses"
licenseVC.loadLicenseList(name: "licenses", viewStyle: .DESC) // without .plist extension
//licenseVC.analytics = self 
self.navigationController?.pushViewController(licenseVC, animated: true)

示例:打开 URL

在 UIViewController 中进行集成

let bundle = Bundle(for: LicensesViewController.self)
let storyboard = UIStoryboard(name: "Licenses", bundle: bundle)

let licenseVC = storyboard.instantiateInitialViewController() as! LicensesViewController
licenseVC.title = "Licenses"
licenseVC.loadLicenseList(name: "licenses", viewStyle: .URL) // without .plist extension
//licenseVC.analytics = self 
self.navigationController?.pushViewController(licenseVC, animated: true)

licenses.plist 文件结构

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>libraries</key>
	<array>
		<dict>
			<key>title</key>
			<string>Appirater</string>
			<key>url</key>
			<string>https://github.com/arashpayan/appirater.git</string>
			<key>license</key>
			<string>MIT License</string>
      <key>desc</key>
			<string>Copyright 2017. [Arash Payan] arash. This library is distributed under the terms of the MIT/X11.
While not required, I greatly encourage and appreciate any improvements that you make to this library be contributed back for the benefit of all who use Appirater.</string>
		</dict>
		<dict>
			<key>title</key>
			<string>AppsPortfolio</string>
			<key>url</key>
			<string>https://github.com/mahmudahsan/AppsPortfolio</string>
			<key>license</key>
			<string>MIT License</string>
      <key>desc</key>
			<string>...</string>
		</dict>
		</dict>
	</array>
</dict>
</plist>

在iOS应用程序中的使用

either

  • 将Licenses/Sources文件夹拖入您的应用Xcode项目中。

or

  • 使用CocoaPods或Swift包管理器在项目中包括Licenses作为依赖项。
pod 'Licenses', :git => 'https://github.com/mahmudahsan/Licenses'

or

pod 'Licenses'
  • 在项目中创建一个新的licenses.plist文件,并提供建筑库的名称、网址和许可。遵循Licenses/Data中提供的licenses.plist文件格式。

有疑问或 Feedback 吗?

请随意在GitHub上创建一个issue,或者在Twitter上找到我@mahmudahsan