[英]Way to easily show all SF Symbols icon in apps
I am working on an app that shows all the features available in SwiftUI.我正在开发一个显示 SwiftUI 中可用的所有功能的应用程序。 As part of it, I wanted to display all the SF Symbols that are available.
作为其中的一部分,我想显示所有可用的 SF 符号。 I was wondering if there was a way to do it easily (without needing to type up all the names/variations).
我想知道是否有一种方法可以轻松完成(无需输入所有名称/变体)。
Thanks谢谢
You can copy them from SF Symbols app ( cmd+A
to select all, and cmd+shift+c
to copy all the names, paste to a text file, and refactor the names to Image(systemName: "NAME")
easily.您可以将它们从 SF Symbols 应用程序(
cmd+A
复制到 select 全部,以及cmd+shift+c
复制所有名称,粘贴到文本文件,并将名称重构为Image(systemName: "NAME")
轻松。
Here is how it's possible.这是可能的。 No warranty of any kind for this code on passing the App Store review process.
对于此代码通过 App Store 审核流程,不提供任何形式的保证。
if let bundle = Bundle(identifier: "com.apple.CoreGlyphs"),
let resourcePath = bundle.path(forResource: "symbol_search", ofType: "plist"),
let plist = NSDictionary(contentsOfFile: resourcePath) {
/// keys in plist are names of all available symbols
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.