使用 Apple 的 SF Symbols 生成设置图标。
可以在 iOS 13+ 及更高版本上使用。
在 Xcode 中,前往 Project -> 你的项目名称 -> Package Dependencies
-> 点击 Plus 按钮。插入 URL
https://github.com/sparrowcode/SettingsIconGenerator
或者将其添加到你的 Package.swift
文件的 dependencies
中
dependencies: [
.package(url: "https://github.com/sparrowcode/SettingsIconGenerator", .upToNextMajor(from: "1.0.0"))
]
这是一种过时的方法。我建议你使用 SPM。但是,我会在一段时间内继续支持 Cocoapods。
CocoaPods 是一个依赖管理器。有关使用和安装说明,请访问他们的网站。要使用 CocoaPods 进行集成,请在你的 Podfile
中指定它
pod 'SettingsIconGenerator'
如果你不想使用任何依赖管理器,你可以手动集成。将 Sources/SettingsIconGenerator
文件夹放入你的 Xcode 项目中。确保启用 Copy items if needed
和 Create groups
。
let image = UIImage.generateSettingsIcon("bell.fill", backgroundColor: .systemBlue)
SettingsIcon("bell.fill", backgroundColor: .systemBlue)
或者如果需要生成图像
Image.generateSettingsIcon("bell.fill", backgroundColor: .systemBlue)
如果你使用了 SettingsIconGenerator
,请通过 Pull Request 添加你的应用。