Search code examples
iosswiftswiftuisf-symbols

Where are SF-Symbols located?


Become used SF-Symbols part of the bundle and become compiled to the executable file? Or are there only references and the actual icons are provided by the OS of the user?


Solution

  • The symbols are stored somewhere in the OS. Your app only contains "references" to them.

    According to this post, the SF symbols in the iPhone simulator are located in:

    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/
    Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/
    Resources/RuntimeRoot/System/Library/PrivateFrameworks/SFSymbols.framework/
    CoreGlyphs.bundle/Assets.car
    

    Notice that this is inside "iOS.simruntime", which is the place where the simulated iOS OS is stored. I would imagine that on a real iOS device, it would be located at the path after "RuntimeRoot":

    /System/Library/PrivateFrameworks/SFSymbols.framework/CoreGlyphs.bundle/Assets.car
    

    Peeking into this Assets.car file, we can see that it has entries like this:

      {
        "AssetType" : "Image",
        "BitsPerComponent" : 8,
        "ColorModel" : "Monochrome",
        "Colorspace" : "gray gamma 22",
        "Compression" : "deepmap2",
        "DeploymentTarget" : "2019",
        "Encoding" : "Gray",
        "Glyph Size" : "Medium",
        "Glyph Weight" : "Regular",
        "Idiom" : "universal",
        "Name" : "square.lefthalf.filled",
        "NameIdentifier" : 54903,
        "Opaque" : false,
        "PixelHeight" : 27,
        "PixelWidth" : 27,
        "RenditionName" : "square.lefthalf.filled.svg",
        "Scale" : 2,
        "SHA1Digest" : "2299C5EE9722FDB79BC6BA4458980605076D4356BA01FC2107228DC99D53E42A",
        "SizeOnDisk" : 338,
        "State" : "Normal"
      },
    

    Notice the "Name" properties are all SF symbol names.