swift_qrcodejs 2.2.2

swift_qrcodejs 2.2.2

Zhiyu Zhu 维护。



QRCodeSwift (swift_qrcodejs)

Latest Release MIT License Swift 5.0+ Compatible with All Platforms

Documentation Code Coverage CocoaPods Compatible Swift Package Manager Compatible Carthage Compatible

一个使用纯 Swift 编写的跨平台 QRCode 生成器,旨在解决在 Apple Watch 上没有 CIFilter 进行 QRCode 生成的尴尬情况。

安装

Swift 包管理器
结合 Xcode 使用

更多详细信息请参阅 官方指南,但总的来说

  1. 在 Xcode 菜单栏中选择:文件 > Swift 包 > 添加包依赖
  2. 输入 https://github.com/ApolloZhu/swift_qrcodejs.git
  3. 然后,指定版本解决规则为 "最高次重大版本更新"
  4. 选择 QRCodeSwift 库并将其添加到您的应用目标中完成。
通过 Package.swift
dependencies: [
    .package(url: "https://github.com/ApolloZhu/swift_qrcodejs.git", from: "2.2.2"),
]

... 然后将 package swift_qrcodejs 中的模块/目标 QRCodeSwift 添加为您依赖项。

CocoaPods
pod 'swift_qrcodejs', '~> 2.2.2'
Carthage

我假设您知道您在做什么(因为我不清楚),但是您可能需要以下内容

github "ApolloZhu/swift_qrcodejs" ~> 2.2.2

注意,Carthage 与 Xcode 12 不兼容(但是这里有解决方法)。

手动添加

Sources 文件夹中所有的 .swift 文件添加到您的项目中。

用法

import QRCodeSwift

guard let qrCode = try? QRCode("Hello World!") else {
    fatalError("Failed to generate QRCode")
}
print(qrCode.toString(filledWith: "##", patchedWith: "  "))

更多内容,请查看 文档

示例项目

许可证

MIT许可证。基于qrcodejs修改。请参阅LICENSE以及每个单独文件的头信息以获取更多信息。