Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is how to get the SF Symbols programatically #8

Open
mackoj opened this issue Sep 28, 2023 · 0 comments
Open

This is how to get the SF Symbols programatically #8

mackoj opened this issue Sep 28, 2023 · 0 comments

Comments

@mackoj
Copy link

mackoj commented Sep 28, 2023

Hi thanks for making your library,

If you want to programmatically obtain the list of symbols, here you go. It's not a complete example because I didn't handle the category, but they are in the bundle. I figure that it is feasible to get them.

They are located in this bundle: /Library/Developer/CoreSimulator/Volumes/iOS_21A328/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/SFSymbols.framework/CoreGlyphs.bundle/

More specifically, in this file: name_availability.plist.

// Read the content of CoreGlyphs
// /Library/Developer/CoreSimulator/Volumes/iOS_21A328/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/SFSymbols.framework

var symbols = [String]()
if let bundle = Bundle(identifier: "com.apple.CoreGlyphs"),
   let resourcePath = bundle.path(forResource: "name_availability", ofType: "plist"),
   let plist = NSDictionary(contentsOfFile: resourcePath),
   let plistSymbols = plist["symbols"] as? [String: String]
{
  symbols = Array(plistSymbols.keys)
}
@mackoj mackoj changed the title The source for SF Symbols This is how to get the SF Symbols programatically Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant