efqrcode是一个轻巧的纯旋转库,用于使用水印或图标生成风格化的QRCode映像,并以QRCode的启发,用于从图像中识别QRCode。基于CoreGraphics , CoreImage和ImageIO ,EFQRCODE为您提供了一种更好的方法来处理应用程序中的QRCode,无论它是否在iOS,MACOS,WatchOS和/或TVOS上。您可以通过Cocoapods,Carthage和/或Swift软件包管理器整合EFQRCODE。
中文介绍
您可以单击下面的App Store按钮以下载演示,支持iOS,TVOS和WatchOS:
您还可以单击下面的Mac App Store按钮以下载MacOS的演示:
要手动运行示例项目,请克隆回购,演示在“示例”文件夹中,请记住run command sh Startup.sh在终端中首先获取所有依赖项,然后使用xcode打开EFQRCode.xcworkspace ,然后选择所需的目标,运行。
或者,您可以在终端中运行以下命令:
git clone [email protected]:EFPrefix/EFQRCode.git ; cd EFQRCode ; sh Startup.sh ; open ' EFQRCode.xcworkspace ' | 版本 | 需要 |
|---|---|
| 1.x | XCode 8.0+ Swift 3.0+ iOS 8.0+ / macOS 10.11+ / tvos 9.0+ |
| 4.x | XCode 9.0+ Swift 4.0+ iOS 8.0+ / macOS 10.11+ / tvos 9.0+ / watchOS 2.0+ |
| 5.x | XCode 11.1+ Swift 5.0+ iOS 8.0+ / macOS 10.11+ / tvos 9.0+ / watchOS 2.0+ |
| 6.x | XCode 12.0+ iOS 9.0+ / macOS 10.10+ / tvos 9.0+ / watchOS 2.0+ |
EFQRCODE可通过CocoApods获得。要安装它,只需将以下行添加到您的podfile:
pod 'EFQRCode' , '~> 6.2.2'然后,运行以下命令:
$ pod install重要的是:这种解决方法对于迦太基必须在Xcode 12中进行某种工作。
迦太基是一个分散的依赖管理器,可建立您的依赖关系并为您提供二进制框架。
您可以使用以下命令使用Homebrew安装迦太基:
$ brew update
$ brew install carthage要使用Carthage将EFQRCODE集成到您的Xcode项目中,请在您的Cartfile中指定:
github "EFPrefix/EFQRCode" ~> 6.2.2
运行carthage update以构建框架并将构建的EFQRCode.framework拖到XCode项目中。
Swift软件包管理器是自动化Swift代码分布的工具,并将其集成到Swift编译器中。
设置了Swift软件包后,将EFQRCODE添加为依赖关系就像将其添加到Package.swift的dependencies项值中一样容易。
dependencies: [
. package ( url : " https://github.com/EFPrefix/EFQRCode.git " , . upToNextMinor ( from : " 6.2.2 " ) )
] 导入要使用它的efqrcode模块:
import EFQRCode返回字符串数组,因为单个CGImage中可能有几个QR码:
if let testImage = UIImage ( named : " test.png " ) ? . cgImage {
let codes = EFQRCode . recognize ( testImage )
if !codes . isEmpty {
print ( " There are ( codes . count ) codes " )
for (index , code ) in codes . enumerated ( ) {
print ( " The content of QR Code ( index ) is ( code ) . " )
}
} else {
print ( " There is no QR Codes in testImage. " )
}
} 创建QR码图像,基本用法:
| 范围 | 描述 |
|---|---|
content | 需要,QR代码的内容 |
size | 图像的宽度和高度 |
backgroundColor | QRCODE的背景颜色 |
foregroundColor | qrcode的前景颜色 |
watermark | QRCODE的背景图像 |
if let image = EFQRCode . generate (
for : " https://github.com/EFPrefix/EFQRCode " ,
watermark : UIImage ( named : " WWF " ) ? . cgImage
) {
print ( " Create QRCode image success ( image ) " )
} else {
print ( " Create QRCode image failed! " )
}结果:
使用EFQRCode.generateGIF创建gif qrcode。
| 范围 | 描述 |
|---|---|
generator | 必需,一个带有其他设置的EFQRCodeGenerator实例 |
data | 需要,编码的输入GIF |
delay | 输出QRCODE GIF延迟,发射意味着没有更改 |
loopCount | 在GIF中循环的时代,发射意味着没有变化 |
if let qrCodeData = EFQRCode . generateGIF (
using : generator , withWatermarkGIF : data
) {
print ( " Create QRCode image success. " )
} else {
print ( " Create QRCode image failed! " )
}您可以从演示中获取更多信息,结果会喜欢:
从用户指南中了解更多信息。
magnification (而是)增加size或扩展;Issue和Pull request 。 PS的PS:希望您可以单击Star按钮,如果此工具对您有用,谢谢,QAQ ...
| 平台/语言 | 关联 |
|---|---|
| Objective-C | https://github.com/z624821876/ysqrcode |
| 爪哇 | https://github.com/sumimimakito/awesomeqrcode |
| JavaScript | https://github.com/sumimimakito/awesome-qr.js |
| 科特林 | https://github.com/sumimimakito/awesomeqrcode-kotlin |
| Python | https://github.com/sylnsfar/qrcode |
由于所有已经为我们做出了贡献的人,该项目的存在。 [贡献]
如果您认为这个项目为您带来了帮助,可以给我买一杯咖啡。如果您喜欢这个项目,并且愿意为其开发提供进一步的支持,则可以选择在Open Collective中成为Backer 。感谢我们所有的支持者! [成为支持者]
演示项目和指南中图片的一部分来自互联网。如果您的合法权利和利益侵犯了任何侵犯,请与我们联系以删除。
电子邮件:[email protected]
EFQRCODE可根据MIT许可获得。有关更多信息,请参见许可证文件。