6

I am working on an app that shows all the features available in SwiftUI. As part of it, I wanted to display all the SF Symbols that are available. I was wondering if there was a way to do it easily (without needing to type up all the names/variations).

Thanks

2 Answers 2

11

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.

2
  • Damn. Didn't even realize that was possible. What do you recommend as the best way to refactor it to get the code to be able to iterate through all of them? Aug 10, 2020 at 2:25
  • With Xcode you can :) (but I think you'll want to split all the symbols in 4-5 fragments, because could be a bit slow to edit all of them at the same time). You can check the xcode multicursor here: stackoverflow.com/questions/50696995/…
    – AlbertUI
    Aug 12, 2020 at 21:18
1

Here is how it's possible. No warranty of any kind for this code on passing the App Store review process.

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

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.